Skip to content

Commit 82fcdd9

Browse files
committed
add $pull filter
1 parent 3d7894a commit 82fcdd9

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-zero",
3-
"version": "0.1.8",
3+
"version": "0.1.9",
44
"description": "Nodejs web project code scaffold base on Koa@2",
55
"main": "index.js",
66
"scripts": {

template/tpl_mongo.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ module.exports = {
310310
var update_doc = null;
311311
delete updatedDoc._id; // don't update _id & createAt field.
312312
delete updatedDoc.createAt;
313-
if (updatedDoc.hasOwnProperty('$push') || updatedDoc.hasOwnProperty('$unset')) {
313+
if (updatedDoc.hasOwnProperty('$push') || updatedDoc.hasOwnProperty('$pull') || updatedDoc.hasOwnProperty('$unset')) {
314314
update_doc = updatedDoc;
315315
} else {
316-
updatedDoc.updateAt = new Date();
316+
updatedDoc.updateAt = Date();
317317
update_doc = { $set: updatedDoc };
318318
}
319319
collection.updateOne(conditionDoc, update_doc, (err, result) => {

0 commit comments

Comments
 (0)