I have this collection:
{ "MAIN": { "A":{row:"smth","Smth4example":"smth"}, "B":{row:"smth2","Smth4example":"smth2"} } } How do I display an object by key A:
{row:"smth","Smth4example":"smth"} I have this collection:
{ "MAIN": { "A":{row:"smth","Smth4example":"smth"}, "B":{row:"smth2","Smth4example":"smth2"} } } How do I display an object by key A:
{row:"smth","Smth4example":"smth"} Correct to make such a request:
db.collectionName.find({"MAIN.A":{$exist: true}}, {_id:0, "MAIN.A":1}) Such a query will return all fields A, from all documents in which it is.
It turned out like this:
db.collectionName.distinct('MAIN.A') Source: https://ru.stackoverflow.com/questions/886218/
All Articles