@@ -616,6 +616,7 @@ export class DatabaseConnection {
616616 return value ;
617617 } ) ;
618618 }
619+ if ( collectionname == "files" ) collectionname = "fs.files" ;
619620 let myhint : Object = { } ;
620621 if ( hint ) {
621622 if ( typeof hint === "string" || hint instanceof String ) {
@@ -651,7 +652,12 @@ export class DatabaseConnection {
651652 const aggregatesjson = JSON . stringify ( aggregates , null , 2 )
652653
653654 span . addEvent ( "getbasequery" ) ;
654- const base = this . getbasequery ( jwt , "_acl" , [ Rights . read ] ) ;
655+ let base : object ;
656+ if ( collectionname == "fs.files" ) {
657+ base = this . getbasequery ( jwt , "metadata._acl" , [ Rights . read ] ) ;
658+ } else {
659+ base = this . getbasequery ( jwt , "_acl" , [ Rights . read ] ) ;
660+ }
655661 if ( Array . isArray ( aggregates ) ) {
656662 aggregates . unshift ( { $match : base } ) ;
657663 } else {
@@ -1819,8 +1825,8 @@ export class DatabaseConnection {
18191825 }
18201826 const ot_end = Logger . otel . startTimer ( ) ;
18211827 const mongodbspan : Span = Logger . otel . startSubSpan ( "mongodb.bulkexecute" , span ) ;
1822- bulkInsert . execute ( )
1823- bulkRemove . execute ( )
1828+ if ( bulkInsert . length > 0 ) bulkInsert . execute ( )
1829+ if ( bulkRemove . length > 0 ) bulkRemove . execute ( )
18241830 Logger . otel . endSpan ( mongodbspan ) ;
18251831 Logger . otel . endTimer ( ot_end , DatabaseConnection . mongodb_deletemany , { collection : collectionname } ) ;
18261832 if ( Config . log_deletes ) Logger . instanse . verbose ( "[" + user . username + "][" + collectionname + "] deleted " + counter + " items in database" ) ;
0 commit comments