1.0.5 • Published 3 years ago

mongo-data-factory v1.0.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

mongo-data-factory

Initialize Factory Seeder

first you need to define your collecetion (table) schema for this example i have a table called Country

const countryFactory = Factory.define(Country, (faker: Faker.FakerStatic) => {
  return {
    name: faker.address.country(),
    code: faker.address.countryCode(),
    currency: faker.finance.currencyCode(),
    timezone: faker.address.timeZone(),
  };
});

Run your factory 🚀

After initialize it you just run one line of code

you could pass as argument your number of records you want to create by default it creates only only one record

countryFactory.create(); // will create one reacord

countryFactory.create(10); // will create 10 reacords

countryFactory.create().then(() => {
  // you could run some logic here to 😀
});
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago