Fix read preference for aggregate (#6585)

* added failing test cases

* fixed test cases for aggregate query

* added read preference option to aggregate router
This commit is contained in:
Manuel
2020-04-28 20:41:33 +02:00
committed by GitHub
parent 288e746888
commit e78c07e169
2 changed files with 84 additions and 0 deletions

View File

@@ -54,6 +54,10 @@ export class AggregateRouter extends ClassesRouter {
options.explain = body.explain;
delete body.explain;
}
if (body.readPreference) {
options.readPreference = body.readPreference;
delete body.readPreference;
}
options.pipeline = AggregateRouter.getPipeline(body);
if (typeof body.where === 'string') {
body.where = JSON.parse(body.where);