Skip to main content
Version: 57.2.0

executeCreate

executeCreate<T>(__namedParameters): Promise<ExecutorResult<T>>

Create a document through the same pipeline as POST /: method-level permissions, transformer.transform, preCreate, Model.create (Mongoose validation), population, and postCreate. Throws APIErrors with the same statuses/titles as the REST handler.

Type Parameters

T

T

Parameters

__namedParameters

body

unknown

model

Model<T>

options

ModelRouterOptions<T>

req?

Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>

The real Express request when called over HTTP; hooks receive a {user} stub otherwise.

skipPostHooks?

boolean

C5 (FIX 6): when true, skip the built-in postCreate call — the caller (the sync mutation handler) runs it manually AFTER finalizing the idempotency ledger applied, so a post-hook throw can never make a committed write look like a failure. REST handlers never set this.

user?

User

Returns

Promise<ExecutorResult<T>>