MCPcopy
hub / github.com/Automattic/mongoose / buildPreSavePromise

Function buildPreSavePromise

lib/model.js:3650–3656  ·  view source on GitHub ↗
(document, options)

Source from the content-addressed store, hash-verified

3648};
3649
3650async function buildPreSavePromise(document, options) {
3651 const preFilter = buildMiddlewareFilter(options, 'pre');
3652 const [newOptions] = await document.schema.s.hooks.execPre('save', document, [options], { filter: preFilter });
3653 if (newOptions !== options) {
3654 throw new MongooseError('Cannot overwrite options in pre("save") hook on bulkSave()');
3655 }
3656}
3657
3658async function handleSuccessfulWrite(document, options) {
3659 if (document.$isNew) {

Callers 1

model.jsFile · 0.85

Calls 1

buildMiddlewareFilterFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…