Remove Stage name check on aggregate pipelines (#7237)
* add search for atlas search index * added test for search in pipeline * removed stage name check in pipeline * removed spec for invalid query invalid key * updated changelog Co-authored-by: Diamond Lewis <findlewis@gmail.com>
This commit is contained in:
@@ -4,38 +4,6 @@ import * as middleware from '../middlewares';
|
||||
import Parse from 'parse/node';
|
||||
import UsersRouter from './UsersRouter';
|
||||
|
||||
const BASE_KEYS = ['where', 'distinct', 'pipeline', 'hint', 'explain'];
|
||||
|
||||
const PIPELINE_KEYS = [
|
||||
'addFields',
|
||||
'bucket',
|
||||
'bucketAuto',
|
||||
'collStats',
|
||||
'count',
|
||||
'currentOp',
|
||||
'facet',
|
||||
'geoNear',
|
||||
'graphLookup',
|
||||
'group',
|
||||
'indexStats',
|
||||
'limit',
|
||||
'listLocalSessions',
|
||||
'listSessions',
|
||||
'lookup',
|
||||
'match',
|
||||
'out',
|
||||
'project',
|
||||
'redact',
|
||||
'replaceRoot',
|
||||
'sample',
|
||||
'skip',
|
||||
'sort',
|
||||
'sortByCount',
|
||||
'unwind',
|
||||
];
|
||||
|
||||
const ALLOWED_KEYS = [...BASE_KEYS, ...PIPELINE_KEYS];
|
||||
|
||||
export class AggregateRouter extends ClassesRouter {
|
||||
handleFind(req) {
|
||||
const body = Object.assign(req.body, ClassesRouter.JSONFromQuery(req.query));
|
||||
@@ -122,9 +90,6 @@ export class AggregateRouter extends ClassesRouter {
|
||||
}
|
||||
|
||||
static transformStage(stageName, stage) {
|
||||
if (ALLOWED_KEYS.indexOf(stageName) === -1) {
|
||||
throw new Parse.Error(Parse.Error.INVALID_QUERY, `Invalid parameter for query: ${stageName}`);
|
||||
}
|
||||
if (stageName === 'group') {
|
||||
if (Object.prototype.hasOwnProperty.call(stage[stageName], '_id')) {
|
||||
throw new Parse.Error(
|
||||
|
||||
Reference in New Issue
Block a user