express-restify-mongoose 9.0.3 β 9.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -26,6 +26,7 @@ type Options = {
|
|
|
26
26
|
preRead: RequestHandler | RequestHandler[];
|
|
27
27
|
preUpdate: RequestHandler | RequestHandler[];
|
|
28
28
|
preDelete: RequestHandler | RequestHandler[];
|
|
29
|
+
updateDeep: boolean;
|
|
29
30
|
access?: (req: Request) => Access | Promise<Access>;
|
|
30
31
|
contextFilter: (model: mongoose.Model<unknown>, req: Request, done: (query: mongoose.Model<unknown> | mongoose.Query<unknown, unknown>) => void) => void;
|
|
31
32
|
postCreate?: RequestHandler | RequestHandler[];
|
package/dist/operations.js
CHANGED
|
@@ -241,7 +241,10 @@ function operations(model, options, filter) {
|
|
|
241
241
|
}
|
|
242
242
|
return dst;
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
let cleanBody = depopulate(req.body);
|
|
245
|
+
if (options.updateDeep) {
|
|
246
|
+
cleanBody = (0, _moredots.moredots)(cleanBody);
|
|
247
|
+
}
|
|
245
248
|
if (options.findOneAndUpdate) {
|
|
246
249
|
options.contextFilter(contextModel, req, (filteredContext)=>{
|
|
247
250
|
// @ts-expect-error this is fine πΆπ₯
|