hola-server 0.3.9 → 0.3.10
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/db/db.js +4 -1
- package/package.json +1 -1
package/db/db.js
CHANGED
|
@@ -27,7 +27,7 @@ const log_msg = (category, level, msg) => {
|
|
|
27
27
|
const path = req ? req.originalUrl : "";
|
|
28
28
|
const user = req && req.session && req.session.user ? req.session.user.id : "";
|
|
29
29
|
|
|
30
|
-
db.create(col_log, { time: time, category: category, level: level, msg: msg, user: user, path: path }).then(() => {});
|
|
30
|
+
db.create(col_log, { time: time, category: category, level: level, msg: msg, user: user, path: path }).then(() => { });
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
const is_log_debug = () => {
|
|
@@ -124,6 +124,7 @@ const bulk_update = async (col, items, attrs) => {
|
|
|
124
124
|
attrs.forEach(function (attr) {
|
|
125
125
|
query[attr] = item[attr];
|
|
126
126
|
});
|
|
127
|
+
delete item["_id"];
|
|
127
128
|
bulk.find(query).upsert().update({ $set: item }, true);
|
|
128
129
|
}
|
|
129
130
|
return await bulk.execute();
|
|
@@ -152,6 +153,7 @@ class DB {
|
|
|
152
153
|
*/
|
|
153
154
|
create(code, obj) {
|
|
154
155
|
const col = this.db[code];
|
|
156
|
+
delete obj["_id"];
|
|
155
157
|
return col.insert(obj, { checkKeys: false });
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -168,6 +170,7 @@ class DB {
|
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
const col = this.db[code];
|
|
173
|
+
delete obj["_id"];
|
|
171
174
|
return col.update(query, { $set: obj }, { upsert: true, multi: true });
|
|
172
175
|
}
|
|
173
176
|
|