Skip to content

Instantly share code, notes, and snippets.

@savokiss
Created February 17, 2017 03:05
Show Gist options
  • Select an option

  • Save savokiss/2f5def4f6e30632bd614fc0ecdfcb11e to your computer and use it in GitHub Desktop.

Select an option

Save savokiss/2f5def4f6e30632bd614fc0ecdfcb11e to your computer and use it in GitHub Desktop.
mongodb remove.js
var mongo = require('mongodb').MongoClient;
var url = 'mongodb://localhost:27017/'+ process.argv[2];
mongo.connect(url, function(err,db){
if(err) throw err;
var col = db.collection(process.argv[3]);
col.remove({
_id: process.argv[4]
},function(err,data){
console.log(data.result);
if(err) throw err;
db.close();
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment