mongodb - How to delete the document based on ObjectId (_id) -


how write mongodb shell query return documents objects created after specific date?

collections like:

{ "_id" : objectid("59918c9014450171039b7e1f"), "cont_id" : "59918c9014450171039b7e1d", "systemdate" : isodate("2017-07-25t00:09:00.567z"), }  db.itemtable.count({"systemdate" : { $gte: isodate("2017-07-25t00:00:00.000z")}}) 

returns - 15210

db.itemtable.count({'_id': {'$gt' : objectid("59918c9014450171039b7e1f")}}) 

returns - 987652

thanks! bharathi

db.itemtable.find({"systemdate" : { $gte: isodate("2017-07-25t00:00:00.000z")}}).count() returns count of documents.

if want cursor documents, use find db.itemtable.find({"systemdate" : { $gte: isodate("2017-07-25t00:00:00.000z")}})


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -