WebTechKitchen; Your Web Technology Kitchen, contact us to create, or maintain your websites and other digital properties.

Mongo sorting and counting queries

Submitted by barnettech on Tue, 11/10/2015 - 15:50

db.getCollection('EZL_QUOTE_RESPONSE').find({}).sort({match_id:-1});  // gets the last records to show ordered.

 

db.getCollection('EZL_QUOTE_RESPONSE').find({}).count();  // gets a count of the documents in the EZL_QUOTE_RESPONSE collection.

 

db.getCollection('EZL_QUOTE_RESPONSE').find({}).sort({"quote_value.QuoteExecutionDetail.QuoteExecutionID":-1});

 

in robomongo on the mac hit command + return to run the query.