Comparing version 4.0.0 to 4.1.0
@@ -46,2 +46,3 @@ /* | ||
this.opts = this.opts.bind(this) | ||
this.createIndex = this.createIndex.bind(this) | ||
this.index = this.ensureIndex = this.ensureIndex.bind(this) | ||
@@ -303,3 +304,3 @@ this.dropIndex = this.dropIndex.bind(this) | ||
* | ||
* https://docs.mongodb.com/manual/reference/method/db.collection.ensureIndex/ | ||
* https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/ | ||
* | ||
@@ -309,10 +310,29 @@ * @param {Object|String|Array} fields | ||
* @param {Function} [fn] callback | ||
* @return {Promise} | ||
*/ | ||
Collection.prototype.createIndex = function (fields, opts, fn) { | ||
if (typeof opts === 'function') { | ||
fn = opts | ||
opts = {} | ||
} | ||
fields = util.fields(fields) | ||
// query | ||
debug('%s createIndex %j (%j)', this.name, fields, opts) | ||
return this.executeWhenOpened().then(function (col) { | ||
return col.createIndex(fields, opts) | ||
}).then(thenFn(fn)).catch(catchFn(fn)) | ||
} | ||
/** | ||
* @deprecated | ||
* Creates indexes on collections. | ||
* | ||
* @example | ||
* https://docs.mongodb.com/manual/reference/method/db.collection.ensureIndex/ | ||
* | ||
* users.index('name.first') | ||
* users.index('name last') | ||
* users.index(['nombre', 'apellido']) | ||
* users.index({ up: 1, down: -1 }) | ||
* users.index({ woot: 1 }, { unique: true }) | ||
* @param {Object|String|Array} fields | ||
* @param {Object} [opts] options | ||
* @param {Function} [fn] callback | ||
* @return {Promise} | ||
@@ -329,2 +349,4 @@ */ | ||
console.warn('DEPRECATED (collection.ensureIndex): use collection.createIndex instead (see https://Automattic.github.io/monk/docs/collection/createIndex.html)') | ||
// query | ||
@@ -485,7 +507,3 @@ debug('%s ensureIndex %j (%j)', this.name, fields, opts) | ||
if (opts.remove) { | ||
console.warn('DEPRECATED (collection.findAndModify): use collection.findOneAndDelete instead (see https://Automattic.github.io/monk/docs/collection/findOneAndDelete.html)') | ||
} else { | ||
console.warn('DEPRECATED (collection.findAndModify): use collection.findOneAndUpdate instead (see https://Automattic.github.io/monk/docs/collection/findOneAndUpdate.html)') | ||
} | ||
console.warn('DEPRECATED (collection.findAndModify): use collection.findOneAndUpdate instead (see https://Automattic.github.io/monk/docs/collection/findOneAndUpdate.html)') | ||
@@ -492,0 +510,0 @@ // `new` defaults to `true` for upserts |
{ | ||
"name": "monk", | ||
"version": "4.0.0", | ||
"description": "The wise MongoDB API", | ||
"version": "4.1.0", | ||
"main": "lib/monk.js", | ||
@@ -19,18 +20,21 @@ "tags": [ | ||
"debug": "*", | ||
"gitbook-plugin-github": "2.0.0", | ||
"mongodb": "^2.1.18" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.15.2", | ||
"codecov": "^1.0.1", | ||
"eslint": "^2.11.1", | ||
"eslint-config-standard": "^5.3.1", | ||
"eslint-plugin-ava": "2.5.0", | ||
"eslint-plugin-promise": "^1.3.2", | ||
"eslint-plugin-standard": "^1.3.2", | ||
"gitbook-cli": "2.3.0", | ||
"gitbook-plugin-anker-enable": "0.0.4", | ||
"gitbook-plugin-edit-link": "2.0.2", | ||
"gitbook-plugin-github": "2.0.0", | ||
"gitbook-plugin-prism": "1.0.0", | ||
"nyc": "^6.4.4" | ||
"ava": "^0.19.1", | ||
"codecov": "^2.2.0", | ||
"eslint": "^3.19.0", | ||
"eslint-config-standard": "^10.2.1", | ||
"eslint-plugin-ava": "^4.2.0", | ||
"eslint-plugin-import": "2.2.0", | ||
"eslint-plugin-node": "4.2.2", | ||
"eslint-plugin-promise": "^3.5.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"gitbook-cli": "^2.3.0", | ||
"gitbook-plugin-anker-enable": "^0.0.4", | ||
"gitbook-plugin-edit-link": "^2.0.2", | ||
"gitbook-plugin-github": "^3.0.0", | ||
"gitbook-plugin-prism": "^2.2.0", | ||
"nyc": "^10.3.2" | ||
}, | ||
@@ -37,0 +41,0 @@ "license": "MIT", |
43503
1116
3
15
+ Addedgitbook-plugin-github@2.0.0
+ Addedgitbook-plugin-github@2.0.0(transitive)