Skip to content

Instantly share code, notes, and snippets.

@lxneng
Created August 6, 2014 06:21
Show Gist options
  • Save lxneng/0b79d373cda4bdfe3dcc to your computer and use it in GitHub Desktop.
Save lxneng/0b79d373cda4bdfe3dcc to your computer and use it in GitHub Desktop.
mongodb distinct multiple fields
collection = db.getCollection('foo')
result = collection.aggregate(
[
{"$group": { "_id": { fa: "$fa", fb: "$fb" } } }
]
);
printjson(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment