Skip to main content
All CollectionsAtlas Frequently Asked Questions
How to Generate Synthetic Data with the Supply Store Dataset
How to Generate Synthetic Data with the Supply Store Dataset
Kabir Ghai avatar
Written by Kabir Ghai
Updated over a year ago
  1. Connect to the MongoDB Shell

    The MongoDB Shell is an interactive JavaScript interface to MongoDB. You can use the MongoDB Shell to quickly and easily create, query, and update data.

  2. Install a random data generator package

    To generate large volumes of synthetic data for development and testing, install a random data generator on the command line. In this example we use Falso.

    $ npm install @ngneat/falso

  3. Run this script in the shell to generate your data

    This script creates a dataset with 1,000 documents following the document pattern provided:

    const falso = require('@ngneat/falso');
    const data = [];
    for (let i = 0; i < 1000; i++) {
    data.push({
    saleDate: falso.randPastDate(),
    storeLocation: falso.randCity(),
    couponUsed: falso.randBoolean(),
    purchaseMethod: falso.randTransactionType(),
    customer: {
    pronoun: falso.randPronoun(),
    age: falso.randNumber({min:18,max:100}),
    email: falso.randEmail(),
    statisfaction: falso.randNumber({min:0,max:10})
    }
    });
    }
    use('supply_store');
    db.sales.insertMany(data);

    Edit the JSON document to modify the data you generate.
    โ€‹
    Change supply_store and sales to customize the name of your dataset.

Did this answer your question?