{
"_id": ObjectId("4ed8d496c605da94400001e4"),
"status": 1,
"user": {
"uid": 1
},
"nid": 10582,
"form": {
"your-name": "Bob Smith",
"description": "",
"photo": "",
"address": "123 Turk Hill Rd",
"city": "",
"zip": "14450"
},
"location": {
"address": "123 Turk Hill Rd",
"city": "",
"zip": "14450",
"geo_lat": 43.0329181,
"geo_lng": -77.4391148,
"address_confirmed": "123 Turk Hill Rd, Victor, NY 14564, USA",
"address_status": 200,
"accuracy": 8
},
"keywords": {
"0": "bob",
"1": "smith",
"2": "",
"4": "123",
"5": "turk",
"6": "hill",
"7": "rd",
"9": "14450"
},
"time": ISODate("2011-12-02T13: 37: 26.0Z")
Search:
{
nid: 10582,
keywords: {"$in": ['turk']}
}
Results: none!
What am I doing wrong?
Answer is simple: because of keywords is not an array. To search on keywords you need to change document structure as follow:
It usually happens when you from driver serialize dictionary. In current moment there is no way to search in such structure. Simple use arrays instead of dictionaries. Or you can convert dictionary to array before serialize document and viсe versa when deserialize document.