UNPKG

mongo-in-cosmos

Version:

Javascript library to embed an arbitrary number of mongoDb dbs/collections within a single cosmosDb collection

27 lines (25 loc) 548 B
/** * Implements http://mongodb.github.io/node-mongodb-native/3.0/api/Collection.html#insertOne * @param {object} cosmosCollection * @param {string} embeddedDbName * @param {string} embeddedCollectionName * @param {object} doc * @param {object} options */ function insertOne ( cosmosCollection, embeddedDbName, embeddedCollectionName, doc, options ) { return cosmosCollection.insertOne( { ...doc, _collection: embeddedCollectionName, _db: embeddedDbName }, options ) } module.exports = insertOne