title: Retrieve all elements in an array in mongoDB
body: <p>How can I assign an array to a variable. I am able to return the documents that I want but not able to specifically get all the elements in the array inside a particular field. This field is called 'likes.'</p>
  
  <p>My query to filter documents I want:</p>
  
  <pre><code>Posts.find({}, {owner: Meteor.user()})
  </code></pre>
  
  <p>I would like to retrieve all the elements inside an array field called 'likes' from the Posts collection. (Each element in the 'likes' field is an object ID)</p>
  
  <p>I tried with various operators such as $all and $in of the 'likes' field and tested within console.log, but I cant manage to get the Ids. According to the mongo docs, I need to specify an element within the operator but I don't want that. I simply want anything that is inside. </p>
  
  <pre><code>var likers = Posts.find({}, {owner: Meteor.user()}, {likes: {$in: [] }})
  </code></pre>
  
  <p>Basically, Im trying to retrieve all the elements from the 'likes' field so I can make another query to return results.</p>
  
  <p>I am running meteor 0.9+</p>