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