Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

mongo-data-factory

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mongo-data-factory

- [mongo-data-factory](#mongo-data-factory) - [Initialize Factory Seeder](#initialize-factory-seeder) - [Run your factory 🚀](#run-your-factory-)

latest
Source
npmnpm
Version
1.0.5
Version published
Maintainers
1
Created
Source

mongo-data-factory

  • mongo-data-factory
  • Initialize Factory Seeder
  • Run your 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 😀
});

FAQs

Package last updated on 30 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts