Accessing Data : Accessing MongoDB data : Specifying the data to retrieve from MongoDB : How to specify what data to retrieve from a MongoDB database
 
How to specify what data to retrieve from a MongoDB database
1 In Data Explorer, right-click Data Sets, then choose New Data Set.
2 In New Data Set, specify the following information:
1 In Data Source Selection, select the MongoDB data source to use. Data Set Type displays MongoDB Data Set.
2 In Data Set Name, type a name for the data set.
3 Choose Next.
3 In New MongoDB Data Set, in Query, do the following:
1 In MongoDB Collection, select the collection from which to retrieve data. Not required if you enter a Run Database Command expression.
2 In Command Operation, in Command type, optionally select a command type. Choose Expression and type an expression in Command Expression Builder. The default command type is FindQuery.
3 In Number of Documents to search for fields, type the number of documents for which to search for fields, then choose Find Fields. The fewer the number of documents to scan, the faster the response.
Available Fields displays the fields defined in the scanned documents. The letter D preceding a field name indicates that the field is a subordinate document. Square brackets ([]) following a field name indicate that the field is an array. If you do not see the fields you expect and want, increase the number of documents to scan, then choose Find Fields.
4 In Available Fields, select the field or fields whose data to retrieve. To move a single field from Available Fields to Selected Fields, select the field and choose >. You can select a field at any level, for example a subordinate document field, not just a leaf field (lowest level). To move all fields in a node from Available Fields to Selected Fields, select the node and choose >>.
Figure 4‑42 shows an example of a MongoDB query.
Figure 4‑42 Example of a MongoDB query
4 Choose Finish to save the data set. Edit Data Set displays the output columns, and provides options for editing the data set.
5 Choose Preview Results to view the data rows returned by the data set.