| 1489 | */ |
| 1490 | |
| 1491 | function _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. |