UNPKG

mongodb-stitch

Version:

[![Join the chat at https://gitter.im/mongodb/stitch](https://badges.gitter.im/mongodb/stitch.svg)](https://gitter.im/mongodb/stitch?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

58 lines (44 loc) 2.01 kB
'use strict'; 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 _collection = require('./collection'); var _collection2 = _interopRequireDefault(_collection); 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 DB instance (not meant to be instantiated directly, use `.db()` on * a {@link MongoDBService} instance). * @class * @return {DB} a DB instance. */ var DB = function () { /** * @hideconstructor */ function DB(client, service, name) { _classCallCheck(this, DB); this.client = client; this.service = service; this.name = name; } /** * Returns a Collection instance representing a MongoDB Collection object. * * @method * @param {String} name The collection name. * @param {Object} [options] Additional options. * @return {Collection} returns a Collection instance representing a MongoDb collection. */ _createClass(DB, [{ key: 'collection', value: function collection(name) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; return new _collection2.default(this, name, options); } }]); return DB; }(); exports.default = DB; module.exports = exports['default'];