| 590 | }; |
| 591 | |
| 592 | function transformNotInQuery(notInQueryObject, className, results) { |
| 593 | var values = []; |
| 594 | for (var result of results) { |
| 595 | values.push({ |
| 596 | __type: 'Pointer', |
| 597 | className: className, |
| 598 | objectId: result.objectId, |
| 599 | }); |
| 600 | } |
| 601 | delete notInQueryObject['$notInQuery']; |
| 602 | if (Array.isArray(notInQueryObject['$nin'])) { |
| 603 | notInQueryObject['$nin'] = notInQueryObject['$nin'].concat(values); |
| 604 | } else { |
| 605 | notInQueryObject['$nin'] = values; |
| 606 | } |
| 607 | } |
| 608 | |
| 609 | // Replaces a $notInQuery clause by running the subquery, if there is an |
| 610 | // $notInQuery clause. |