This object is in archive! 

ObjectId as an option for test data generator

Anton Sorokin shared this idea 5 years ago
Under Consideration

Would be nice to have an option to generate ObjectID field in test data generator dialog. Ideally I want to have an option to randomly spread all the generated objects between preselected set of IDs or between IDs from the other collection.

Simple use case - I want to generate 10K documents with userId property and assign those document userIds to lets say random userId from users collection.

Replies (1)


The following code may be a little help.


sampleDoc.userId=  _.sample(userIds); // will return one item randomly from the  userIds array

Leave a Comment
Attach a file