I have some problems with mongoDB, i looked for an answer but i couldn’t find anything
that solves my problem….
db.coders.save( {
'name': 'John',
'languages' : { 'php':'bad','java':'good','brainfuck':'very bad'}
});
db.coders.save( {
'name': 'Sarah',
'languages' : { 'php':'good','java':'bad','brainfuck':'very bad'}
});
db.coders.save( {
'name': 'Tom',
'languages' : { 'php':'very good','java':'good','brainfuck':'bad'}
});
now i want to find any coder that knows any language ‘very good’…how?
You could not find it because it is impossible. None of the search operators works on the schema you provided.
The easiest workaround is to change schema a little bit:
In such a case you can query the data using the following query: