Answer the question
In order to leave comments, you need to log in
Mongo: How to select a part of a multidimensional array?
Please don’t beat me hard - I’m still an absolute noob in Mongo
. So, I have already “virtuously” learned how to select objects by exact match (for example, ID), but what stunned me is how to make a selection if complex multidimensional arrays are stored, but you need to select only those that match partially.
For example:
{'id':123
'response':{
'one':'one',
'two':{'two':'two'},
'type':'text'
}
},
{'id':1234
'response':{
'one':'one',
'three':{'three':'three'},
'type':'text'
}
}
Answer the question
In order to leave comments, you need to log in
You need to write like this:
db.collection.find({'response.type':'text'}})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question