| 638 | handle.$nor = createLogicalQueryOperatorHandler('$nor'); |
| 639 | |
| 640 | function createLogicalQueryOperatorHandler(op) { |
| 641 | return function logicalQueryOperatorHandler(val) { |
| 642 | if (!Array.isArray(val)) { |
| 643 | throw new TypeError('conditional ' + op + ' requires an array'); |
| 644 | } |
| 645 | |
| 646 | const ret = []; |
| 647 | for (const obj of val) { |
| 648 | ret.push(cast(this.casterConstructor.schema, obj, null, this && this.$$context)); |
| 649 | } |
| 650 | |
| 651 | return ret; |
| 652 | }; |
| 653 | } |
| 654 | |
| 655 | handle.$near = |
| 656 | handle.$nearSphere = geospatial.cast$near; |