Skip to content

Instantly share code, notes, and snippets.

@rbpasker
Created May 29, 2013 15:25
Show Gist options
  • Save rbpasker/5671160 to your computer and use it in GitHub Desktop.
Save rbpasker/5671160 to your computer and use it in GitHub Desktop.
counts = Metadata.group(key={'metadata_type':1},
condition={"owner" : self.owner.id,
"attributes.attribute_type" : {"$in", self.md_fields}
},
initial={"count":0},
reduce_f="""function (current, result) { result.count++}""",
finalize_f=None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment