Skip to content

Instantly share code, notes, and snippets.

@francois
Forked from banker/gist:352135
Created April 1, 2010 17:55
Show Gist options
  • Save francois/352141 to your computer and use it in GitHub Desktop.
Save francois/352141 to your computer and use it in GitHub Desktop.
{"rp":
{"AdSpot": [
{"1": {"mt": {"im": {"va": 141}, "ck": {"va": 13}}}},
{"2": {"mt": {"im": {"va": 237}, "ck": {"va": 12}}}},
{"3": {"mt": {"im": {"va": 671}, "ck": {"va": 21}}}}]
},
"_id": ObjectID("a")
}
{"rp":
{"AdSpot": [
{"2": {"mt": {}},
{"4": {"mt": {"im": {"va": 123}, "ck": {"va": 13}}}},
{"5": {"mt": {"im": {"va": 999}, "ck": {"va": 13}}}}]
},
"_id": ObjectID("b")
}
{"rp":
{"AdSpot": [
{"4": {"mt": {"im": {"va": 0}}}},
{"5": {"mt": {"im": {"va": 13}, "ck": {"va": 11}}}},
{"6": {"mt": {"im": {"va": 2}, "ck": {"va": 9}}}}]
},
"_id": ObjectID("c")
}
# I want to find documents a and b, given [1, 2]. a matches because rp.AdSpot has keys of both 1 and 2.
# Document b matches because 2 is one of the keys of rp.AdSpot.
db.collection.find({...})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment