MCPcopy Create free account
hub / github.com/Automattic/mongoose / EmbeddedDocument

Function EmbeddedDocument

lib/schema/documentArray.js:142–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

140
141 // compile an embedded document for this schema
142 function EmbeddedDocument() {
143 Subdocument.apply(this, arguments);
144 // `ArraySubdocument` already looked up the parent array's parent doc, so
145 // reuse it rather than going through the document array proxy again.
146 const parent = this[documentArrayParent];
147 if (parent == null) {
148 return;
149 }
150 this.$session(parent.$session());
151 }
152
153 // Must run before `$__setSchema()`, which compiles virtuals onto the prototype
154 schema.plugin(idGetter, { deduplicate: true });

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected