monastery 1.39.1 → 1.40.0
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 +4 -0
- package/docs/model/find.md +1 -1
- package/docs/model/remove.md +1 -1
- package/docs/model/update.md +1 -1
- package/lib/index.js +4 -3
- package/package.json +1 -1
package/changelog.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
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
|
+
## [1.40.0](https://github.com/boycce/monastery/compare/1.39.2...1.40.0) (2022-12-14)
|
|
6
|
+
|
|
7
|
+
### [1.39.2](https://github.com/boycce/monastery/compare/1.39.1...1.39.2) (2022-09-12)
|
|
8
|
+
|
|
5
9
|
### [1.39.1](https://github.com/boycce/monastery/compare/1.39.0...1.39.1) (2022-09-12)
|
|
6
10
|
|
|
7
11
|
## [1.39.0](https://github.com/boycce/monastery/compare/1.38.3...1.39.0) (2022-09-11)
|
package/docs/model/find.md
CHANGED
|
@@ -11,7 +11,7 @@ Find document(s) in a collection and call the model hook: `afterFind`
|
|
|
11
11
|
|
|
12
12
|
`options` *(object)*
|
|
13
13
|
|
|
14
|
-
- `query` *(object\|id)
|
|
14
|
+
- `query` *(object\|id)*: [`MongoDB query document`](https://www.mongodb.com/docs/v4.4/tutorial/query-documents/), or id
|
|
15
15
|
- [[`blacklist`](#blacklisting)] *(array\|string\|false)*: augment `definition.findBL`. `false` will remove all blacklisting
|
|
16
16
|
- [`getSignedUrls`] *(boolean)*: get signed urls for all image objects
|
|
17
17
|
- [[`populate`](#populate)] *(array)*
|
package/docs/model/remove.md
CHANGED
|
@@ -11,7 +11,7 @@ Remove document(s) in a collection and calls model hooks: `beforeRemove`, `afte
|
|
|
11
11
|
|
|
12
12
|
`options` *(object)*
|
|
13
13
|
|
|
14
|
-
- `query` *(object\|id)
|
|
14
|
+
- `query` *(object\|id)*: [`MongoDB query document`](https://www.mongodb.com/docs/v4.4/tutorial/query-documents/), or id
|
|
15
15
|
- [`sort`] *(string\|object\|array)*: same as the mongodb option, but allows for string parsing e.g. 'name', 'name:1'
|
|
16
16
|
- [[`any mongodb option`](http://mongodb.github.io/node-mongodb-native/3.2/api/Collection.html#remove)] *(any)*
|
|
17
17
|
|
package/docs/model/update.md
CHANGED
|
@@ -11,7 +11,7 @@ Update document(s) in a collection and calls model hooks: `beforeUpdate`, `afte
|
|
|
11
11
|
|
|
12
12
|
`options` *(object)*
|
|
13
13
|
|
|
14
|
-
- `query` *(object\|id)
|
|
14
|
+
- `query` *(object\|id)*: [`MongoDB query document`](https://www.mongodb.com/docs/v4.4/tutorial/query-documents/), or id
|
|
15
15
|
- [`data`](#data) *(object)* - data that's validated against the model fields (always wrapped in `{ $set: .. }`)
|
|
16
16
|
- [[`blacklist`](#blacklisting)]*(array\|string\|false)*: augment `definition.updateBL`. `false` will remove all blacklisting
|
|
17
17
|
- [`project`] *(string\|array\|object)*: project these fields, ignores blacklisting
|
package/lib/index.js
CHANGED
|
@@ -77,7 +77,7 @@ let arrayWithSchema = function(array, schema) {
|
|
|
77
77
|
return array
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
let models = async function(pathname) {
|
|
80
|
+
let models = async function(pathname, waitForIndexes) {
|
|
81
81
|
/**
|
|
82
82
|
* Setup model definitions from a folder location
|
|
83
83
|
* @param {string} pathname
|
|
@@ -91,9 +91,10 @@ let models = async function(pathname) {
|
|
|
91
91
|
let filenames = fs.readdirSync(pathname)
|
|
92
92
|
for (let filename of filenames) {
|
|
93
93
|
let filepath = path.join(pathname, filename)
|
|
94
|
-
let definition = await import(filepath)
|
|
94
|
+
let definition = (await import(filepath)).default
|
|
95
95
|
let name = filename.replace('.js', '')
|
|
96
|
-
out[name] = this.model(name, definition)
|
|
96
|
+
if (waitForIndexes) out[name] = out[name] = this.model(name, { ...definition, waitForIndexes })
|
|
97
|
+
else out[name] = this.model(name, definition)
|
|
97
98
|
}
|
|
98
99
|
return out
|
|
99
100
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "monastery",
|
|
3
3
|
"description": "⛪ A straight forward MongoDB ODM built around Monk",
|
|
4
4
|
"author": "Ricky Boyce",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.40.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "github:boycce/monastery",
|
|
8
8
|
"homepage": "https://boycce.github.io/monastery/",
|