cosa 7.1.0 → 7.1.2
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/lib/model.js +3 -1
- package/package.json +6 -6
package/lib/model.js
CHANGED
|
@@ -124,6 +124,9 @@ const _create = (data, definition) => {
|
|
|
124
124
|
return context;
|
|
125
125
|
}
|
|
126
126
|
let obj = context.toObject();
|
|
127
|
+
if (explicitId && context.isNew()) {
|
|
128
|
+
obj._id = explicitId;
|
|
129
|
+
}
|
|
127
130
|
if ('function' === typeof context.beforeSave) {
|
|
128
131
|
await context.beforeSave.apply(obj, [options]);
|
|
129
132
|
}
|
|
@@ -156,7 +159,6 @@ const _create = (data, definition) => {
|
|
|
156
159
|
}, { silent: true });
|
|
157
160
|
} else {
|
|
158
161
|
obj._etag = newEtag;
|
|
159
|
-
if (explicitId) { obj._id = explicitId; }
|
|
160
162
|
debug(`inserting into ${collection}: ${JSON.stringify(obj)}`);
|
|
161
163
|
try {
|
|
162
164
|
result = await db.insert(collection, obj, options);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cosa",
|
|
3
|
-
"version": "7.1.
|
|
3
|
+
"version": "7.1.2",
|
|
4
4
|
"description": "Cosa Models for MongoDB",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"engines": {
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"debug": "^4.3.4",
|
|
41
41
|
"error": "^7.0.2",
|
|
42
42
|
"etag": "^1.8.1",
|
|
43
|
-
"joi": "^17.9.
|
|
44
|
-
"mongodb": "~4.
|
|
43
|
+
"joi": "^17.9.2",
|
|
44
|
+
"mongodb": "~4.17.1",
|
|
45
45
|
"object-path": "^0.11.8",
|
|
46
|
-
"omnibelt": "^3.1.
|
|
46
|
+
"omnibelt": "^3.1.2"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@losant/eslint-config-losant": "^1.6.1",
|
|
50
50
|
"husky": "^8.0.3",
|
|
51
|
-
"lint-staged": "
|
|
51
|
+
"lint-staged": "~13.2.3",
|
|
52
52
|
"chai": "^4.3.7",
|
|
53
53
|
"chai-as-promised": "^7.1.1",
|
|
54
54
|
"chai-datetime": "^1.8.0",
|
|
55
|
-
"documentation": "^14.0.
|
|
55
|
+
"documentation": "^14.0.2",
|
|
56
56
|
"mocha": "^10.2.0",
|
|
57
57
|
"string-template": "^1.0.0"
|
|
58
58
|
},
|