Skip to content

Instantly share code, notes, and snippets.

@airportyh
Created September 21, 2012 15:08
Show Gist options
  • Select an option

  • Save airportyh/3762060 to your computer and use it in GitHub Desktop.

Select an option

Save airportyh/3762060 to your computer and use it in GitHub Desktop.
Mongodb Group Statement
db.element_views.group({
key: {element_id: true}
, cond: {
browser: 'Chrome',
os: 'MacOS',
device_type: 'Desktop'
}
, reduce: function(v, prev){
prev.sum++
}
, initial: {sum: 0}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment