Skip to content

Instantly share code, notes, and snippets.

@eladonline
Created June 22, 2017 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eladonline/0d248e6b84b9982027aed4e99b1319f7 to your computer and use it in GitHub Desktop.
Save eladonline/0d248e6b84b9982027aed4e99b1319f7 to your computer and use it in GitHub Desktop.
learnyoumongo FIND PROJECT Exercise 4 of 9
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