Created
June 22, 2017 08:36
-
-
Save eladonline/0d248e6b84b9982027aed4e99b1319f7 to your computer and use it in GitHub Desktop.
learnyoumongo FIND PROJECT Exercise 4 of 9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var mongo = require("mongodb").MongoClient | |
| const url = "mongodb://localhost:27017/learnyoumongo", | |
| age = process.argv[2] | |
| mongo.connect(url,function(err,db){ | |
| if(err){ throw err | |
| }else{ | |
| var parrot = db.collection("parrots") | |
| parrot.find( | |
| { age:{$gt : +age}} ,{_id:0} | |
| ).toArray(function(err,doc){ | |
| err ?console.log(err) | |
| :console.log(doc) | |
| }) | |
| } | |
| db.close() | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment