File tree Expand file tree Collapse file tree 1 file changed +0
-7
lines changed Expand file tree Collapse file tree 1 file changed +0
-7
lines changed Original file line number Diff line number Diff line change @@ -597,17 +597,10 @@ export class MongoProvider<StoredValue = unknown> extends JoshProvider<StoredVal
597
597
return payload ;
598
598
}
599
599
600
- // Due to the use of $sample, the output will never have duplicates
601
600
public async [ Method . Random ] ( payload : Payload . Random < StoredValue > ) : Promise < Payload . Random < StoredValue > > {
602
601
let { count, unique } = payload ;
603
602
const size = await this . collection . countDocuments ( { } ) ;
604
603
605
- // TODO: @dan -online fix this yourself idk how this work
606
- // Basically just this:
607
- // if(unique && size < count) throw InvalidCount
608
- // if (size === 0) throw MissingData
609
- // Also try no to get an infinite loop with unique off and count > size
610
-
611
604
if ( unique && size < count ) {
612
605
payload . errors . push ( this . error ( { identifier : CommonIdentifiers . InvalidCount , method : Method . Random } , { size } ) ) ;
613
606
You can’t perform that action at this time.
0 commit comments