Skip to content

Instantly share code, notes, and snippets.

@jiangzhuo
Last active August 29, 2015 14:14
Show Gist options
  • Save jiangzhuo/6c2714195b03c3e9af04 to your computer and use it in GitHub Desktop.
Save jiangzhuo/6c2714195b03c3e9af04 to your computer and use it in GitHub Desktop.
db.areas.aggregate(
[
{
$project: {
areaId: 1,
numberOfResource: { $size: "$resources" }
}
}
]
)
var max=0;
db.areas.find().forEach(function(obj) {
var curr = Object.bsonsize(obj);
if(max < curr) {
max = curr;
}
})
print(max);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment