Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are minimongo (Meteor) limitations? cursor.toArray() fails client side

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!

like image 423
Cerulean Avatar asked Sep 25 '14 18:09

Cerulean


People also ask

What is toArray in MongoDB?

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.

What is Minimongo?

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.


1 Answers

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

like image 159
saimeunt Avatar answered Oct 18 '22 09:10

saimeunt