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