| 659 | handle.$nor = createLogicalQueryOperatorHandler('$nor'); |
| 660 | |
| 661 | function createLogicalQueryOperatorHandler(op) { |
| 662 | return function logicalQueryOperatorHandler(val, context) { |
| 663 | if (!Array.isArray(val)) { |
| 664 | throw new TypeError('conditional ' + op + ' requires an array'); |
| 665 | } |
| 666 | |
| 667 | const ret = []; |
| 668 | for (const obj of val) { |
| 669 | ret.push(cast(this.embeddedSchemaType.schema ?? context.schema, obj, null, this?.$$context)); |
| 670 | } |
| 671 | |
| 672 | return ret; |
| 673 | }; |
| 674 | } |
| 675 | |
| 676 | handle.$near = |
| 677 | handle.$nearSphere = geospatial.cast$near; |