Created
April 2, 2019 14:19
-
-
Save rao123dk/12cf68bd6a93ffe7fdbfc21c1495eb7e to your computer and use it in GitHub Desktop.
This file contains 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 MongoClient = require('mongodb').MongoClient; | |
var url = "mongodb://localhost:27017/"; | |
var mongoose = require('mongoose'); | |
var myobj = { | |
"billPlan" : "Annual", | |
"code" : 20003, | |
"rating" : { | |
"totalFees" : "27K", | |
"Code" : 201704, | |
} | |
}; | |
MongoClient.connect(url, function(err, db) { | |
if (err) throw err; | |
var dbo = db.db("mymongoDBDatabase"); | |
setInterval(()=>{ | |
myobj._id = mongoose.Types.ObjectId(); | |
myobj.uniqueId = +new Date(); | |
dbo.collection("bills").insertOne(myobj, function(err, res) { | |
if (err) throw err; | |
console.log("1 document inserted"); | |
}); | |
}, 10) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment