Nested mongodb ObjectId from dataset

Hi there,

is there a way to create data where one of the nested field is a nested ObjectId, however the objectid value will be randomly picked from a dataset of objectids strings and when generated it will be in the format that allows mongodb to properly import the data as objectid and not string. here is what i mean

this is my mockaroo schema

dataset looks like this

59e11548cae4082d2074f097
59e102b3682f0d57f049c279
59e102b3682f0d57f049c27b
59e102b3682f0d57f049c27d
59e102b3682f0d57f049c27f
59e102b3682f0d57f049c281
59e102b3682f0d57f049c283
59e102b3682f0d57f049c285
59e102b3682f0d57f049c287
59e102b3682f0d57f049c289

so when the data is generate it will look like this

[
{
“createdBy”: {
“$oid”:“59e102b3682f0d57f049c27b”
},
“title”:“lectus aliquam sit amet”,
… .

},
{
“createdBy”: {
“$oid”:“59e102b3682f0d57f049c27c”
},
“title”:“frfwrfwr gf3gvrver 3rgrvregerg”,


}
]

thank you for your help

got it working

just added a formula to return the values as mongodb obejctid :slight_smile:

mongo_object_id(this) and voila i get it n the
{
“createdBy”: {
“$oid”:“59e102b3682f0d57f049c27b”
},
using random objectids from my dataset

You could also use dot notation in the field name to create the desired structure: