I was butting my head yesterday trying to get an array of query results within Meteor using
cursor.toArray()
(See http://docs.mongodb.org/manual/reference/method/cursor.toArray/)
I could not get it to work. Finally I tried it in the Meteor mongo console and it worked fine.
I'm a Meteor newbie — what am I missing here? is there a reference that tells me what mongo code can be executed client side ? I looked in the Meteor docs and wasn't able to find. When I look for what I can do in Meteor I often find myself looking through the Mongo docs (as per above) — to what extent are these relevant in minimongo?
Thanks!
The toArray() method returns an array that contains all the documents from a cursor. The method iterates completely the cursor, loading all the documents into RAM and exhausting the cursor.
minimongo is a lightweight, schemaless, Pythonic Object-Oriented interface to MongoDB. It provides a very thin, dynamicly typed (schema-less) object management layer for any data stored in any MongoDB collection. minimongo directly calls the existing pymongo query syntax.
I think you should stick to the Mongo collections part in the Meteor docs :
https://docs.meteor.com/api/collections.html
This is the reference which addresses subject such as current minimongo limitations and most importantly, which API are available on the client and on the server regarding MongoDB manipulation.
As far as toArray
is concerned, the closest minimongo implemented counterpart would be fetch
.
https://docs.meteor.com/api/collections.html#Mongo-Cursor-fetch
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