Skip to content

Commit 8823594

Browse files
committed
FIX save for update method
1 parent 16b3486 commit 8823594

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

lib/model/baseModel.classFactory.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,11 @@ const injectIlorm = ilorm => {
169169
// If something need to be updated:
170170
const query = this.getQueryPrimary();
171171

172-
const update = this[LIST_UPDATED_FIELDS].reduce((finalUpdate, property) => {
173-
finalUpdate[property] = this[property];
174-
175-
return finalUpdate;
176-
}, {});
172+
this[LIST_UPDATED_FIELDS].forEach(field => {
173+
query[field].set(this[field]);
174+
});
177175

178-
await this.constructor.getConnector().updateOne(query, update);
176+
await this.constructor.getConnector().updateOne(query);
179177

180178
this[LIST_UPDATED_FIELDS] = [];
181179

lib/query/baseQuery.classFactory/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ const injectIlorm = ilorm => {
236236
updateBuilder({ onOperator, }) {
237237
if (onOperator) {
238238
for (const { field, operator, value, } of this[UPDATE]) {
239-
onOperator(field, operator, value);
239+
onOperator({ field, operator, value });
240240
}
241241
}
242242
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ilorm",
3-
"version": "0.3.0",
3+
"version": "0.3.1",
44
"description": "Core package of ilorm ORM",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)