Skip to content

Commit

Permalink
Merge pull request #31 from SOURAV-ROY/ROY
Browse files Browse the repository at this point in the history
  • Loading branch information
SOURAV-ROY authored Dec 1, 2024
2 parents a40ee45 + 8e2f489 commit 2f52c11
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
64 changes: 32 additions & 32 deletions _data/seed.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
const {faker} = require("@faker-js/faker");
const { faker } = require("@faker-js/faker");
// const CountryIndexingModel = require('../models/CountryIndexingModel');
const UserModel = require("../models/UserModel");
const mongoose = require("mongoose");
require("colors");

async function seedData() {
// Connection URL
const uri = "String";
const seedCount = 5000;
mongoose
.connect(uri, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
})
.then(() => {
console.log("Connected To MongoDB".cyan.bold);
})
.catch((err) => {
console.log("ERROR".red.bold, err);
});
// Connection URL
const uri = "String";
const seedCount = 5000;
mongoose
.connect(uri, {
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
})
.then(() => {
console.log("Connected To MongoDB".cyan.bold);
})
.catch((err) => {
console.log("ERROR".red.bold, err);
});

let timeSeriesData = [];
// create 5000 fake data
for (let i = 0; i < seedCount; i++) {
const name = faker.person.firstName();
const email = faker.internet.email();
timeSeriesData.push({name, email});
}
let timeSeriesData = [];
// create 5000 fake data
for (let i = 0; i < seedCount; i++) {
const name = faker.person.firstName();
const email = faker.internet.email();
timeSeriesData.push({ name, email });
}

console.log(timeSeriesData);
const seedDB = async () => {
await UserModel.insertMany(timeSeriesData);
};
console.log(timeSeriesData);
const seedDB = async () => {
await UserModel.insertMany(timeSeriesData);
};

seedDB().then(() => {
mongoose.connection.close();
});
seedDB().then(() => {
mongoose.connection.close();
});
}

seedData().then(() => {
console.log("SUCCESSFULLY INSERT".green.bold);
console.log("SUCCESSFULLY INSERT".green.bold);
});
19 changes: 10 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"dev": "nodemon index.js"
},
"keywords": [],
"author": "",
"author": "SOURAV ROY",
"license": "ISC",
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"@faker-js/faker": "^9.2.0",
"nodemon": "^2.0.9"
},
"dependencies": {
Expand Down

1 comment on commit 2f52c11

@vercel
Copy link

@vercel vercel bot commented on 2f52c11 Dec 1, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

bootcamps – ./

bootcamps.vercel.app
bootcamps-sourav-roy.vercel.app
bootcamps-git-sourav-sourav-roy.vercel.app

Please sign in to comment.