| 1598 | */ |
| 1599 | |
| 1600 | function _isManuallyPopulatedArray(val, ref) { |
| 1601 | if (!Array.isArray(val)) { |
| 1602 | return false; |
| 1603 | } |
| 1604 | if (val.length === 0) { |
| 1605 | return false; |
| 1606 | } |
| 1607 | |
| 1608 | for (const el of val) { |
| 1609 | if (!(el instanceof Document)) { |
| 1610 | return false; |
| 1611 | } |
| 1612 | const modelName = el.constructor.modelName; |
| 1613 | if (modelName == null) { |
| 1614 | return false; |
| 1615 | } |
| 1616 | if (el.constructor.modelName != ref && el.constructor.baseModelName != ref) { |
| 1617 | return false; |
| 1618 | } |
| 1619 | } |
| 1620 | |
| 1621 | return true; |
| 1622 | } |
| 1623 | |
| 1624 | /** |
| 1625 | * Sets the value of a path, or many paths. |