File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -597,17 +597,10 @@ export class MongoProvider<StoredValue = unknown> extends JoshProvider<StoredVal
597597 return payload ;
598598 }
599599
600- // Due to the use of $sample, the output will never have duplicates
601600 public async [ Method . Random ] ( payload : Payload . Random < StoredValue > ) : Promise < Payload . Random < StoredValue > > {
602601 let { count, unique } = payload ;
603602 const size = await this . collection . countDocuments ( { } ) ;
604603
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-
611604 if ( unique && size < count ) {
612605 payload . errors . push ( this . error ( { identifier : CommonIdentifiers . InvalidCount , method : Method . Random } , { size } ) ) ;
613606
You can’t perform that action at this time.
0 commit comments