Skip to content

Instantly share code, notes, and snippets.

@saifsmailbox98
Created July 14, 2017 22:43
Show Gist options
  • Save saifsmailbox98/71d12e7ddc29426a856a7c92d3456805 to your computer and use it in GitHub Desktop.
Save saifsmailbox98/71d12e7ddc29426a856a7c92d3456805 to your computer and use it in GitHub Desktop.
var mongo = require('mongodb').MongoClient
var age = process.argv[2]
var url = 'mongodb://localhost:27017/learnyoumongo'
mongo.connect(url, function(err, db) {
if (err) throw err
var parrots = db.collection('parrots')
parrots.find({
age: {
$gt: +age
}
}).toArray(function(err, docs) {
if (err) throw err
console.log(docs)
db.close()
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment