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

Function createWithDocArray

test/types/create.test.ts:147–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147async function createWithDocArray() {
148 const schema = new Schema({ name: String, subdocs: [new Schema({ prop: { type: String, required: true } })] });
149 const TestModel = model('Test', schema);
150 const doc = await TestModel.create({ name: 'test', subdocs: [{ prop: 'value' }] });
151 expect(doc.name).type.toBe<string | null | undefined>();
152 expect(doc.subdocs[0].prop).type.toBe<string>();
153}
154
155async function createWithMapOfSubdocs() {
156 const schema = new Schema({

Callers

nothing calls this directly

Calls 2

modelFunction · 0.85
createMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…