Does the $slice function work in Meteor MongoDB?
Here is some query sample:
Posts.find({"permalink":"udrskijwddhigfwhecxn"},{"comments":{"$slice":10}});
I tried querying in the mini MongoDB and directly through publish using parameters, but it always return the complete nested data.
{
_id:Object(1231o2j3lkqj),
body:"this is body",
author:"machine",
permalink:"udrskijwddhigfwhecxn"
title:"this is title",
tags: ["dog","cat","tree"]
comments: [{
body:"comment body",
author:"lara",
email:"[email protected]"
},
...]
date:ISODate("2013-03-16T02:50:27.881Z")
}
you can split the following. by using The projection in Meteor and it is specified by fields.
Posts.find({"permalink":"udrskijwddhigfwhecxn"},
{
fields:{"comments":{"$slice":10}}
})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With