json - MongoDB find().count() - SyntaxError: missing : after property id (shell):1 -


have .json data-supplied collection of tweets..

looking count delete-requests in sessions:

db.tweets.find({"delete"}).count() 

and syntax incorrect because syntaxerror: missing : after property id (shell):1

have more find() , count() operations perform, error consistent.

this delete-request looks (where "" either series of letters and/or numbers):

{     "_id" : objectid("…"),     "delete" : {         "status" : {             "id" : numberlong("…"),             "user_id" : …,             "id_str" : "…",             "user_id_str" : "…"         }     } } 

in find() function have pass object. missed key/value, because {"delete"} isn't valid object.

i think want number of documents have delete key. have use $exists operator true value.

db.tweets.find({ "delete": { $exists: true } }).count(); 

or directly

db.tweets.count({ "delete": { $exists: true } }); 

from documentation:

$exists selects documents contain field if true. if false, query returns documents not contain field. documents contain field has value null not returned.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -