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

Function _isManuallyPopulatedArray

lib/document.js:1491–1513  ·  view source on GitHub ↗
(val, ref)

Source from the content-addressed store, hash-verified

1489 */
1490
1491function _isManuallyPopulatedArray(val, ref) {
1492 if (!Array.isArray(val)) {
1493 return false;
1494 }
1495 if (val.length === 0) {
1496 return false;
1497 }
1498
1499 for (const el of val) {
1500 if (!(el instanceof Document)) {
1501 return false;
1502 }
1503 const modelName = el.constructor.modelName;
1504 if (modelName == null) {
1505 return false;
1506 }
1507 if (el.constructor.modelName != ref && el.constructor.baseModelName != ref) {
1508 return false;
1509 }
1510 }
1511
1512 return true;
1513}
1514
1515/**
1516 * Sets the value of a path, or many paths.

Callers 1

document.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected