Skip to content

Instantly share code, notes, and snippets.

@ronycohen
Last active December 7, 2015 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronycohen/b617fcdec968e2dd6f5e to your computer and use it in GitHub Desktop.
Save ronycohen/b617fcdec968e2dd6f5e to your computer and use it in GitHub Desktop.
DESIGN DOC
{"$or":[{"name":"james"},{"name":"doe"}]}
{
"_id": "_design/19398d38b0a026e2b1e4a82dfa5aea65a51c0782",
"_rev": "1-a500b8628ef2ae8123b6f6f527288d01",
"language": "query",
"views": {
"19398d38b0a026e2b1e4a82dfa5aea65a51c0782": {
"map": {
"fields": {
"name": "asc",
"colors": "asc",
"timestamp": "asc"
}
},
"reduce": "_count",
"options": {
"def": {
"fields": [
"name",
"colors",
"timestamp"
]
},
"w": 2
}
}
}
}
selector : {
"$and": [
{
'timestamp': {'$gte': 0},
},
{
"$or" : [
{
"$and" : [
{"name":{"$eq":"james"}},
{"colors":{"$elemMatch":{"$in":["red","blue"]}}}
]},
{
"$and" : [
{"name":{"$eq":"doe"}},
{"colors":{"$elemMatch":{"$in":["orange","black"]}}}
]}
]
}
]
}
selector : {
"$and": [
{
'timestamp': {'$gte': 0},
},
{
"$and" : [
{"name":{"$eq":"doe"}},
{"colors":{"$elemMatch":{"$in":["red","blue","black"]}}}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment