Skip to content

Commit 27bb051

Browse files
mongo count
1 parent c4765ad commit 27bb051

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Diff for: mongoCount.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var mongo=require('mongodb').MongoClient;
2+
mongo.connect('mongodb://localhost:27017/learnyoumongo',function (er,db) {
3+
if (er) console.log('Eroare:'+er);
4+
var col=db.collection('parrots');
5+
col.count({'age': {$gt:+process.argv[2]}}
6+
,function(err,cnt)
7+
{
8+
if (err) console.log('Error:'+err)
9+
else
10+
console.log(cnt);
11+
db.close();
12+
});
13+
});

0 commit comments

Comments
 (0)