inProgress-team / react-native-meteor

Meteor Reactivity for your React Native application :)
MIT License
693 stars 210 forks source link

Meteor.collection(collectionName).find().sort().limit(1) #184

Closed nyxynyx closed 7 years ago

nyxynyx commented 7 years ago

I'm trying to use .limit(1) to retrieve just the most recent document inserted into the collection

Meteor.collection('zoo').find().sort({createdAt: -1}).limit(1)

However, this throws an error

undefined is not a function (evaluating '_reactNativeMeteor2.default.collection('zoo').find().limit(1)')

Has the .limit function not been implemented?

noris666 commented 7 years ago

@nyxynyx i use limit inside options. Look this URL: http://docs.meteor.com/api/collections.html#Mongo-Collection-find

fakenickels commented 7 years ago

Limit and other options isn't chained in Minimongo, take a look in the link @noris666 sent