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 saveObjects = function (objects) { | |
var MongoC = MongoClient; | |
var mongoConnect = Q.nbind(MongoC.connect, MongoC); | |
return mongoConnect(dbString).then(function (db) { | |
var DocumentCollection = db.collection('collection'); | |
var documentCollectionUpsert = Q.nbind(DocumentCollection.update, DocumentCollection); | |
//Use upsert option. | |
var options = { 'upsert' : true }; | |
var upsertPromises = objects.map(function (obj) { |
NewerOlder