I'm trying to build mongoDB query based on python's dictionaries. The problem that a key should be unique in dicts. See the example
MongoDB data:
{
"_id" : ObjectId("4dcd3ebc9278000000005158"),
col1 : 'foo'
}
{
"_id" : ObjectId("4dcd3ebc9278000000005159"),
col1 : 'bar'
}
Python code:
dict = {'col1': 'foo'}
dict.update({'col1': 'bar'})
db.test.find(dict)
shows only one line with col1=='bar'
>>> dict
{'col1': 'bar'}
How can I build the right MongoDB query using dictionaries (or anything) which does not need to have unique keys.
Thanks!