php - MongoDB get the id of a subdocument with ought loading the document -


an attribute in collection references collection's document looks this

collection {     "reffeddoc": {          "$ref": "myclass",          "$id": objectid("4e171cade3a9f23359e98206")        },     .... } 

so, how select reffeddoc.$id in fields? can fetch withought fetching entire subdocument? i've tried reffeddoc.$id

db.collection.find({}, {"reffeddoc.$id"}); 

and following error

positional operator not match query specifier 


Comments

Popular posts from this blog

PHP Error "Undefined index" -

C# List<> to xml -

php - How to only save new tweets/instagram photos to database? -