mongodb-stitch
Version:
[](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
58 lines (44 loc) • 2.07 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _db = require('./db');
var _db2 = _interopRequireDefault(_db);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Creates a new MongoDBService instance (not meant to be instantiated directly, use
* `.service('mongodb', '<service-name>')` on a {@link StitchClient} instance.
*
* @class
* @return {MongoDBService} a MongoDBService instance.
*/
var MongoDBService = function () {
/**
* @hideconstructor
*/
function MongoDBService(stitchClient, serviceName) {
_classCallCheck(this, MongoDBService);
this.stitchClient = stitchClient;
this.serviceName = serviceName;
}
/**
* Get a DB instance
*
* @method
* @param {String} databaseName The MongoDB database name
* @param {Object} [options] Additional options.
* @return {DB} returns a DB instance representing a MongoDB database.
*/
_createClass(MongoDBService, [{
key: 'db',
value: function db(databaseName) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
return new _db2.default(this.stitchClient, this.serviceName, databaseName);
}
}]);
return MongoDBService;
}();
exports.default = MongoDBService;
module.exports = exports['default'];
;