mirror of
https://github.com/Mastermindzh/examples.git
synced 2024-11-22 08:42:06 +01:00
19 lines
350 B
JavaScript
19 lines
350 B
JavaScript
var result = [];
|
|
db.getCollectionInfos().forEach(function(collection) {
|
|
var collectionResult = {name: collection.name, count: db[collection.name].count()}
|
|
result.push(collectionResult);
|
|
});
|
|
printjson(result);
|
|
|
|
// resulting in:
|
|
// [
|
|
// {
|
|
// "name" : "test",
|
|
// "count" : 1
|
|
// },
|
|
// {
|
|
// "name" : "test2",
|
|
// "count" : 3
|
|
// }
|
|
// ]
|