Wednesday, 7 June 2017

How to return an array of the single field from a Collection

SCENARIO:

Consider a query below

SolvedQuestionaire.find({userId : Meteor.userId(), result: 1},{questions: 1});  

I am just retrieving single field questions from all documents in a Collection.

REQUIREMENT:

I want to convert it to an array of questions like ['capital of India?', 'total states in India?' ....]

which is the best efficient way to do that?

NOTE: using latest Meteor 1.5 and Mongo 3.2



via Ankur Soni

No comments:

Post a Comment