monastery 3.1.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/changelog.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.1.1](https://github.com/boycce/monastery/compare/3.1.0...3.1.1) (2024-05-27)
6
+
5
7
  ## [3.1.0](https://github.com/boycce/monastery/compare/3.0.23...3.1.0) (2024-05-27)
6
8
 
7
9
  ### [3.0.23](https://github.com/boycce/monastery/compare/3.0.22...3.0.23) (2024-05-25)
package/lib/model-crud.js CHANGED
@@ -33,7 +33,8 @@ Model.prototype.insert = async function (opts) {
33
33
  * @param {array|string|false} <opts.blacklist> - augment schema.insertBL, `false` will remove blacklisting
34
34
  * @param {array|string} <opts.project> - return only these fields, ignores blacklisting
35
35
  * @param {boolean} <opts.respond> - automatically call res.json/error (requires opts.req)
36
- * @param {array|string|true} <opts.skipValidation> - skip validation for this field name(s)
36
+ * @param {array|string|true} <opts.skipValidation> - skip validation on these fields, or pass `true` to skip
37
+ * all fields and hooks
37
38
  * @param {boolean} <opts.timestamps> - whether `createdAt` and `updatedAt` are automatically inserted
38
39
  * @param {array|string|false} <opts.validateUndefined> - validates all 'required' undefined fields, true by
39
40
  * default, but false on update
@@ -223,7 +224,8 @@ Model.prototype.findOneAndUpdate = async function (opts) {
223
224
  *
224
225
  * Update options:
225
226
  * @param {object|array} opts.data - mongodb document update object(s)
226
- * @param {array|string|true} <opts.skipValidation> - skip validation for this field name(s)
227
+ * @param {array|string|true} <opts.skipValidation>- skip validation on these fields, or pass `true` to skip
228
+ * all fields and hooks
227
229
  * @param {boolean} <opts.timestamps> - whether `updatedAt` is automatically updated
228
230
  * @param {array|string|false} <opts.validateUndefined> - validates all 'required' undefined fields, true by
229
231
  * default, but false on update
@@ -261,7 +263,8 @@ Model.prototype.update = async function (opts, type='update') {
261
263
  * @param {array|string} <opts.project> - return only these fields, ignores blacklisting
262
264
  * @param {object} <opts.query> - mongodb query object
263
265
  * @param {boolean} <opts.respond> - automatically call res.json/error (requires opts.req)
264
- * @param {array|string|true} <opts.skipValidation> - skip validation for this field name(s)
266
+ * @param {array|string|true} <opts.skipValidation> - skip validation on these fields, or pass `true` to skip
267
+ * all fields and hooks
265
268
  * @param {boolean} <opts.timestamps> - whether `updatedAt` is automatically updated
266
269
  * @param {array|string|false} <opts.validateUndefined> - validates all 'required' undefined fields, true by
267
270
  * default, but false on update
@@ -9,7 +9,8 @@ Model.prototype.validate = async function (data, opts) {
9
9
  * @param {object} <opts>
10
10
  * @param {array|string|false} <opts.blacklist> - augment insertBL/updateBL, `false` will remove blacklisting
11
11
  * @param {array|string} <opts.project> - return only these fields, ignores blacklisting
12
- * @param {array|string|true} <opts.skipValidation> - skip validation on these fields
12
+ * @param {array|string|true} <opts.skipValidation> - skip validation on these fields, or pass `true` to skip
13
+ * all fields and hooks
13
14
  * @param {boolean} <opts.timestamps> - whether `createdAt` and `updatedAt` are inserted, or `updatedAt` is
14
15
  * updated, depending on the `options.update` value
15
16
  * @param {boolean(false)} <opts.update> - are we validating for insert or update? todo: change to `type`
@@ -25,6 +26,7 @@ Model.prototype.validate = async function (data, opts) {
25
26
  opts.update = opts.update || opts.findOneAndUpdate
26
27
  opts.insert = !opts.update
27
28
  opts.skipValidation = opts.skipValidation === true ? true : util.toArray(opts.skipValidation||[])
29
+ if (opts.skipValidation === true) return data
28
30
 
29
31
  // Get projection
30
32
  if (opts.project) var projectionValidate = this._getProjectionFromProject(opts.project)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "monastery",
3
3
  "description": "⛪ A simple, straightforward MongoDB ODM",
4
4
  "author": "Ricky Boyce",
5
- "version": "3.1.0",
5
+ "version": "3.1.1",
6
6
  "license": "MIT",
7
7
  "repository": "github:boycce/monastery",
8
8
  "homepage": "https://boycce.github.io/monastery/",