Skip to content

Function: toDocumentArray()

toDocumentArray(input): Record<string, unknown>[]

Parse a JSON document payload the model / a route supplied for a write. Accepts an already-parsed array/object or a JSON string, and always returns an array so a single document and a batch are handled the same way. Throws a ValidationError on unparseable input so the caller can surface it.

unknown

Record<string, unknown>[]