Is it possible to store the result of a mongodb statement in array using jquery
I have like this
Polls_Coll.find({},{question:1});
I want all the question filed records to store in array some thing like
var arr[]=Polls_Coll.find({},{question:1});
I know above thing is wrong. I need something like that.
I need it for autocompletion. Now i'm taking source from one collection like this
source:_(Product_Mobiles.find().fetch()).pluck("title")
I want data from multiple sources and store it in array
Thanks
Using the mongo console you can do this with .toArray() like
var results = db.collection.find({}).toArray();
However, this might depend on the driver you are using... I guess the javascript driver has it as well.
If your problem is putting all the results from multiple sources into a single array: How to merge two arrays in Javascript and de-duplicate items
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