BoumTAC
BoumTAC

Reputation: 3771

meteor mongodb limit return only id

I want to limit the number of post I get from my query

db.posts.find({});

I got all my posts. I only want the first 10 posts so I've done this.

db.posts.find({}, {limit: 10});

But instead of having 10 posts, it only return id from all my posts

Upvotes: 1

Views: 247

Answers (1)

Michel Floyd
Michel Floyd

Reputation: 20227

It looks like you're doing this in the mongo shell rather than in your Meteor app directly. The limit syntax differs slightly between the two environments:

Mongo shell (docs):

db.posts.find().limit( 10 )

Meteor js:

posts.find({},{limit: 10});

Upvotes: 2

Related Questions