not-node 5.0.12 → 5.0.13
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/package.json +1 -1
- package/src/model/default.js +5 -2
package/package.json
CHANGED
package/src/model/default.js
CHANGED
|
@@ -74,13 +74,15 @@ function sanitizeInput(input) {
|
|
|
74
74
|
* @static
|
|
75
75
|
* @param {string} id primary key
|
|
76
76
|
* @param {Array} population optional if needed population of some fields
|
|
77
|
+
* @param {Object} condition optional if needed additional condition
|
|
77
78
|
* @return {Promise} Promise
|
|
78
79
|
**/
|
|
79
|
-
function getOne(id, population = []) {
|
|
80
|
+
function getOne(id, population = [], condition = {}) {
|
|
80
81
|
let query;
|
|
81
82
|
if (this.schema.statics.__versioning) {
|
|
82
83
|
query = this.findOne({
|
|
83
84
|
_id: id,
|
|
85
|
+
...condition,
|
|
84
86
|
__latest: true,
|
|
85
87
|
__closed: false
|
|
86
88
|
});
|
|
@@ -91,7 +93,8 @@ function getOne(id, population = []) {
|
|
|
91
93
|
}
|
|
92
94
|
} else {
|
|
93
95
|
query = this.findOne({
|
|
94
|
-
_id: id
|
|
96
|
+
_id: id,
|
|
97
|
+
...condition
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
populateQuery(query, population, this.schema.statics.__versioning);
|