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

Function _formatMatch

lib/helpers/populate/createPopulateQueryFilter.js:97–105  ·  view source on GitHub ↗

* Format `mod.match` given that it may be an array that we need to $or if * the client has multiple docs with match functions * @param {Array|any} match * @api private

(match)

Source from the content-addressed store, hash-verified

95 */
96
97function _formatMatch(match) {
98 if (Array.isArray(match)) {
99 if (match.length > 1) {
100 return { $or: [].concat(match.map(m => Object.assign({}, m))) };
101 }
102 return Object.assign({}, match[0]);
103 }
104 return Object.assign({}, match);
105}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected