Skip to content

Commit

Permalink
fix return values
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Sep 24, 2023
1 parent e5996da commit 77d3619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"program": "${workspaceRoot}/dev",
"cwd": "${workspaceRoot}",
"args": [
"moleculer-db-adapter-mongo",
"issue"
"moleculer-db-adapter-mongoose",
"simple"
]
},
{
Expand Down
10 changes: 7 additions & 3 deletions packages/moleculer-db-adapter-mongoose/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ class MongooseDbAdapter {
* @memberof MongooseDbAdapter
*/
updateMany(query, update) {
return this.model.updateMany(query, update, { multi: true, "new": true }).then(res => res.n);
return this.model.updateMany(query, update, { multi: true, "new": true }).then(res => {
return res.modifiedCount;
});
}

/**
Expand All @@ -272,7 +274,9 @@ class MongooseDbAdapter {
* @memberof MongooseDbAdapter
*/
removeMany(query) {
return this.model.deleteMany(query).then(res => res.n);
return this.model.deleteMany(query).then(res => {
return res.deletedCount;
});
}

/**
Expand All @@ -295,7 +299,7 @@ class MongooseDbAdapter {
* @memberof MongooseDbAdapter
*/
clear() {
return this.model.deleteMany({}).then(res => res.n);
return this.model.deleteMany({}).then(res => res.deletedCount);
}

/**
Expand Down

0 comments on commit 77d3619

Please sign in to comment.