MongoDB PHP Limit the returning values of a field <pre><code>{ name : "name 1", field : [ { random:"value 1", random2:"second value" } { random:"value 2", random2:"second value 2" } { random:"value 3", random2:"second value 3" } { random:"value 4", random2:"second value 4" } ] } { name : "name 2", field : [ { random:"value 5", random2:"second value" } { random:"value 6", random2:"second value 6" } { random:"value 7", random2:"second value 7" } { random:"value 8", random2:"second value 8" } { random:"value 9", random2:"second value 9" } ] } </code></pre> <p>i have a collection like this. what i want to do is, when i query this collection, i want only first 2 arrays of the field to return.</p> <p>expected return:</p> <pre><code>{ name : "name 1", field : [ { random:"value 1", random2:"second value" } { random:"value 2", random2:"second value 2" } ] } { name : "name 2", field : [ { random:"value 5", random2:"second value" } { random:"value 6", random2:"second value 6" } ] } </code></pre> <p>i've checked <a href="http://docs.mongodb.org/manual/reference/operator/query-modifier/" rel="nofollow">Query Modifiers</a> but they are sorting/limiting the documents, not fields in the documents.</p> <p>So how can i accomplish this?</p>