Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,29 @@ class Service extends AdapterService {
query = Object.assign(query, { collation: params.collation });
}

const findParams = Object.assign({}, params, {
paginate: false
});
const remapModifier = this._remapModifiers(this._normalizeId(id, data));

return this.Model.updateMany(query, remapModifier, options)
.then(() => this._findOrGet(id, findParams))
.then(select(params, this.id))
.catch(errorHandler);
const idParams = Object.assign({}, params, {
paginate: false,
});

const ids = this._findOrGet(id, idParams)
.then(result => {
const items = Array.isArray(result) ? result : [result];
return items.map(item => item[this.id]);
});

return ids.then(idList => {
const findParams = Object.assign({}, params, {
paginate: false,
query: { [this.id]: { $in: idList } }
});

return this.Model.updateMany(query, remapModifier, options)
.then(() => this._findOrGet(id, findParams))
.then(select(params, this.id))
.catch(errorHandler);
});
}

_update (id, data, params = {}) {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"@feathersjs/errors": "^4.5.3"
},
"devDependencies": {
"@feathersjs/adapter-tests": "^4.5.2",
"@feathersjs/adapter-tests": "^4.5.4",
"@feathersjs/express": "^4.5.4",
"@feathersjs/feathers": "^4.5.3",
"@feathersjs/socketio": "^4.5.4",
Expand Down
1 change: 1 addition & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const testSuite = adapterTests([
'.patch + id + query',
'.patch multiple',
'.patch multi query',
'.patch multi query changed',
'.patch + NotFound',
'.create',
'.create + $select',
Expand Down