lykmapipo / mongoose-faker

mongoose plugin to generate fake model data
MIT License
15 stars 4 forks source link

generator random with arrayElement #6

Closed xpicio closed 5 years ago

xpicio commented 5 years ago

Hello, is here any way to use the random generator with type arrayElement ? Checking the code it's seem not supported but i am not sure :)

xpicio commented 5 years ago

nevermind i fixed my issue in this way:

    field: {
        type: String,
        require: true,
        index: true,
        required: [true, "Property is required"],
        fake: faker => {
            return faker.random.arrayElement(["01", "02" , "03", "04"]);
        }
    }