Database Reference
In-Depth Information
"kiwi"
],
"vegetables" : "potato"
},
...
],
"ok" : 1
}
That's better than before, as now our documents are not as big. But still better would be to cut down on the
number of documents returned. Our next operator will help with that.
$skip
$skip is a pipeline operator complementary to the $limit operator, but instead of limiting results to the first X
documents, it skips over the first X documents and returns all other remaining documents. We can use it to cut down
on the number of documents returned. If we add it to our previous query with a value of 2995, we will return only five
results. This would give us the following query:
[
{ $unwind : "$vegetables" },
{ $project : { _id: 0, fruits:1, vegetables:1 } },
{ $skip : 2995 }
]
With a result of
{
"result" : [
{
"fruits" : [
"kiwi",
"pear",
"lemon"
],
"vegetables" : "pumpkin"
},
{
"fruits" : [
"kiwi",
"pear",
"lemon"
],
"vegetables" : "mushroom"
},
{
"fruits" : [
"pear",
"lemon",
"cherry"
],
 
Search WWH ::




Custom Search