diff --git a/docs/Datastore.md b/docs/Datastore.md index 25aef46..bd2a3f7 100644 --- a/docs/Datastore.md +++ b/docs/Datastore.md @@ -434,14 +434,12 @@ interpreted as the callback.

- query [query](#query) -

is the same kind of finding query you use with find and findOne

- update [document](#document) | \* -

specifies how the documents should be modified. It is either a new document or a -set of modifiers (you cannot use both together, it doesn't make sense!):

- +set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the +matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can +apply them to subdocs. Available field modifiers are $set to change a field's value, $unset to delete a field, +$inc to increment a field's value and $min/$max to change field's value, only if provided value is +less/greater than current value. To work on arrays, you have $push, $pop, $addToSet, $pull, and the special +$each and $slice.

- [options|] Object | [updateCallback](#Datastore..updateCallback) -

Optional options

- [.multi] boolean = false -

If true, can update multiple documents

- [.upsert] boolean = false -

If true, can insert a new document corresponding to the update rules if @@ -464,14 +462,12 @@ if the update did not actually modify them.

- query [query](#query) -

is the same kind of finding query you use with find and findOne

- update [document](#document) | \* -

specifies how the documents should be modified. It is either a new document or a -set of modifiers (you cannot use both together, it doesn't make sense!):

- +set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the +matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can +apply them to subdocs. Available field modifiers are $set to change a field's value, $unset to delete a field, +$inc to increment a field's value and $min/$max to change field's value, only if provided value is +less/greater than current value. To work on arrays, you have $push, $pop, $addToSet, $pull, and the special +$each and $slice.

- [options] Object = {} -

Optional options

- [.multi] boolean = false -

If true, can update multiple documents

- [.upsert] boolean = false -

If true, can insert a new document corresponding to the update rules if diff --git a/lib/datastore.js b/lib/datastore.js index 63e4a71..a64daef 100755 --- a/lib/datastore.js +++ b/lib/datastore.js @@ -852,12 +852,12 @@ class Datastore extends EventEmitter { * Use {@link Datastore#update} which has the same signature. * @param {query} query is the same kind of finding query you use with `find` and `findOne` * @param {document|update} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!): - * - A new document will replace the matched docs - * - The modifiers create the fields they need to modify if they don't exist, and you can apply them to subdocs. - * Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, `$inc` to increment a - * field's value and `$min`/`$max` to change field's value, only if provided value is less/greater than current - * value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special `$each` and `$slice`. + * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the + * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can + * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, + * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is + * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special + * `$each` and `$slice`. * @param {object} [options] Optional options. If not given, is interpreted as the callback. * @param {boolean} [options.multi = false] If true, can update multiple documents * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if @@ -884,12 +884,12 @@ class Datastore extends EventEmitter { * Use {@link Datastore#updateAsync} which has the same signature. * @param {query} query is the same kind of finding query you use with `find` and `findOne` * @param {document|update} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!): - * - A new document will replace the matched docs - * - The modifiers create the fields they need to modify if they don't exist, and you can apply them to subdocs. - * Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, `$inc` to increment a - * field's value and `$min`/`$max` to change field's value, only if provided value is less/greater than current - * value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special `$each` and `$slice`. + * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the + * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can + * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, + * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is + * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special + * `$each` and `$slice`. * @param {Object} options options * @param {boolean} [options.multi = false] If true, can update multiple documents * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if @@ -972,12 +972,12 @@ class Datastore extends EventEmitter { * Update all docs matching query. * @param {query} query is the same kind of finding query you use with `find` and `findOne` * @param {document|*} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!): - * - A new document will replace the matched docs - * - The modifiers create the fields they need to modify if they don't exist, and you can apply them to subdocs. - * Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, `$inc` to increment a - * field's value and `$min`/`$max` to change field's value, only if provided value is less/greater than current - * value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special `$each` and `$slice`. + * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the + * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can + * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, + * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is + * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special + * `$each` and `$slice`. * @param {Object|Datastore~updateCallback} [options|] Optional options * @param {boolean} [options.multi = false] If true, can update multiple documents * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if @@ -1003,12 +1003,12 @@ class Datastore extends EventEmitter { * Async version of {@link Datastore#update}. * @param {query} query is the same kind of finding query you use with `find` and `findOne` * @param {document|*} update specifies how the documents should be modified. It is either a new document or a - * set of modifiers (you cannot use both together, it doesn't make sense!): - * - A new document will replace the matched docs - * - The modifiers create the fields they need to modify if they don't exist, and you can apply them to subdocs. - * Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, `$inc` to increment a - * field's value and `$min`/`$max` to change field's value, only if provided value is less/greater than current - * value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special `$each` and `$slice`. + * set of modifiers (you cannot use both together, it doesn't make sense!). Using a new document will replace the + * matched docs. Using a set of modifiers will create the fields they need to modify if they don't exist, and you can + * apply them to subdocs. Available field modifiers are `$set` to change a field's value, `$unset` to delete a field, + * `$inc` to increment a field's value and `$min`/`$max` to change field's value, only if provided value is + * less/greater than current value. To work on arrays, you have `$push`, `$pop`, `$addToSet`, `$pull`, and the special + * `$each` and `$slice`. * @param {Object} [options = {}] Optional options * @param {boolean} [options.multi = false] If true, can update multiple documents * @param {boolean} [options.upsert = false] If true, can insert a new document corresponding to the `update` rules if