Skip to content

Commit b96b5b2

Browse files
authored
Merge pull request feathersjs-ecosystem#494 from KidkArolis/fix-soft-delete-eq-usage
Remove redundant $eq to be compatible with all database adapters
2 parents fd6d4cb + 9e12403 commit b96b5b2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/services/soft-delete-2.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
How the softDelete2 hook is to be positioned relative to other possible hooks:
44
55
before: {
6-
// Add { deletedAt: { $eq: -1 } } to params.query.
6+
// Add { deletedAt: -1 } to params.query.
77
find: [...hooks1, softDelete(), ...hooks2],
88
// Add { deletedAt: -1 } to the (array of) data objects.
99
// Existing deletedAt props will not be overridden if options.keepOnCreate = true.
@@ -19,10 +19,10 @@
1919
// before: softDelete2() is a no-op. after: softDelete2() throws if record is marked deleted.
2020
get: [...hooks1, softDelete({ skipProbeOnGet: true }), ...hooks2], // options.skipProbeOnGet: true
2121
// If context.id provided: throw if record is deleted, else continue.
22-
// If not provided: add { deletedAt: { $eq: -1 } } to params.query.
22+
// If not provided: add { deletedAt: -1 } to params.query.
2323
patch: [...hooks1, softDelete(), ...hooks2],
2424
// If context.id provided: throw if record is deleted.
25-
// If not provided: add { deletedAt: { $eq: -1 } } to params.query.
25+
// If not provided: add { deletedAt: -1 } to params.query.
2626
// Then in both cases: perform a removing patch call. On this removing patch call
2727
// - before hooks positioned before softDelete will be run.
2828
// - before hooks positioned after softDelete will not be run.
@@ -110,7 +110,7 @@ module.exports = function (options = {}) {
110110

111111
switch (method) {
112112
case 'find':
113-
context.params.query = addField(context.params.query, deletedAt, { $eq: -1 });
113+
context.params.query = addField(context.params.query, deletedAt, -1);
114114
return context;
115115
case 'create':
116116
const data = context.data;
@@ -134,13 +134,13 @@ module.exports = function (options = {}) {
134134
return context;
135135
}
136136

137-
context.params.query = addField(context.params.query, deletedAt, { $eq: -1 });
137+
context.params.query = addField(context.params.query, deletedAt, -1);
138138
return context;
139139
case 'remove':
140140
if (hasId) {
141141
await getActiveRecord(options, context);
142142
} else {
143-
context.params.query = addField(context.params.query, deletedAt, { $eq: -1 });
143+
context.params.query = addField(context.params.query, deletedAt, -1);
144144
}
145145

146146
context.result = await patchCall(context, options);

0 commit comments

Comments
 (0)