Created
May 5, 2017 00:54
-
-
Save ethanwillis/5d378f62ed118ec8975a049e4359f822 to your computer and use it in GitHub Desktop.
Mongo Client Example
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 mongo_url = "mongodb://localhost:27017/mydbname" | |
MongoClient.connect(settings.application_settings.mongo_url, function(err, db_client) { | |
var mongo_collection = db_client.collection("a_collection_name"); | |
// Insert empty object { } or whatever you want | |
mongo_collection.insert({ }, function(err, result) { | |
// handle err and result | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment