@@ -207,6 +207,7 @@ export class DatabaseConnection {
207207 */
208208 async aggregate < T extends Base > ( aggregates : object [ ] , collectionname : string , jwt : string ) : Promise < T [ ] > {
209209 await this . connect ( ) ;
210+ aggregates . unshift ( this . getbasequery ( jwt , "_acl" , [ Rights . read ] ) ) ;
210211 // todo: add permissions check on aggregates
211212 // aggregates.unshift(this.getbasequery(jwt, [Rights.read]));
212213 var items : T [ ] = await this . db . collection ( collectionname ) . aggregate ( aggregates ) . toArray ( ) ;
@@ -258,6 +259,9 @@ export class DatabaseConnection {
258259 }
259260 var inline : boolean = false ;
260261 var opt : MapReduceOptions = { query : q , out : { replace : "map_temp_res" } , finalize : finalize } ;
262+
263+ // (opt as any).w = 0;
264+
261265 var outcol : string = "map_temp_res" ;
262266 if ( out === null || out === undefined || out === "" ) {
263267 opt . out = { replace : outcol } ;
@@ -272,11 +276,12 @@ export class DatabaseConnection {
272276 if ( out . hasOwnProperty ( "inline" ) ) { inline = true ; }
273277 }
274278 opt . scope = scope ;
275- opt . readPreference = ReadPreference . PRIMARY_PREFERRED ;
279+ // opt.readPreference = ReadPreference.PRIMARY_PREFERRED;
276280
277281 // var result:T[] = await this.db.collection(collectionname).mapReduce(map, reduce, {query: q, out : {inline : 1}});
278282 try {
279283 if ( inline ) {
284+ opt . out = { inline : 1 } ;
280285 var result : T [ ] = await this . db . collection ( collectionname ) . mapReduce ( map , reduce , opt ) ;
281286 return result ;
282287 } else {
0 commit comments