mongo-in-cosmos
Version:
Javascript library to embed an arbitrary number of mongoDb dbs/collections within a single cosmosDb collection
26 lines (22 loc) • 513 B
JavaScript
const collection = require('./collection')
/**
* returns embedded db
* @param {object} cosmosCollection mongoDb native driver collection connected w/ cosmos db/collection details
* @param {string} embeddedDbName name of embedded db
*/
function db (
cosmosCollection,
embeddedDbName
) {
// binds an implemented method
const bindImpl = method =>
method.bind(
this,
cosmosCollection,
embeddedDbName
)
return {
collection: bindImpl(collection)
}
}
module.exports = db