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

Function _completeManyLean

lib/query.js:4074–4096  ·  view source on GitHub ↗
(schema, docs, path, opts)

Source from the content-addressed store, hash-verified

4072 */
4073
4074function _completeManyLean(schema, docs, path, opts) {
4075 if (opts.lean && typeof opts.lean.transform === 'function') {
4076 for (const doc of docs) {
4077 opts.lean.transform(doc);
4078 }
4079
4080 for (let i = 0; i < schema.childSchemas.length; i++) {
4081 const childPath = path ? path + '.' + schema.childSchemas[i].model.path : schema.childSchemas[i].model.path;
4082 const _schema = schema.childSchemas[i].schema;
4083 let doc = mpath.get(childPath, docs);
4084 if (doc == null) {
4085 continue;
4086 }
4087 doc = doc.flat();
4088 for (let i = 0; i < doc.length; i++) {
4089 opts.lean.transform(doc[i]);
4090 }
4091 _completeManyLean(_schema, doc, childPath, opts);
4092 }
4093 }
4094
4095 return docs;
4096}
4097/**
4098 * Override mquery.prototype._mergeUpdate to handle mongoose objects in
4099 * updates.

Callers 1

query.jsFile · 0.85

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…