Skip to content

Commit

Permalink
Adding scripts for migrating data to db
Browse files Browse the repository at this point in the history
  • Loading branch information
pstrassmann committed Jul 29, 2020
1 parent d8e148a commit dbdb5d4
Show file tree
Hide file tree
Showing 6 changed files with 603 additions and 2 deletions.
5 changes: 5 additions & 0 deletions package-lock.json

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

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js",
"server": "nodemon server.js",
"process": "node scripts/addNewDogs.js",
"msandbox": "node scripts/mongooseSandbox.js",
"process": "node scripts/populateDataFromVetting.js",
"client": "npm run dev --prefix client",
"dev": "concurrently \"npm run server\" \"npm run client\""
},
Expand All @@ -16,6 +17,7 @@
"dependencies": {
"dotenv": "^8.2.0",
"express": "^4.17.1",
"moment": "^2.27.0",
"mongoose": "^5.9.25",
"morgan": "^1.10.0",
"passport": "^0.4.1"
Expand Down
1 change: 0 additions & 1 deletion scripts/addNewDogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ const Dog = require('../models/Dog');
const Person = require('../models/Person');
const connectDB = require('../config/db');
const dotenv = require('dotenv');

dotenv.config({ path: './config/config.env' });
connectDB();

Expand Down
13 changes: 13 additions & 0 deletions scripts/mongooseSandbox.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const Dog = require('../models/Dog');
const Person = require('../models/Person');
const connectDB = require('../config/db');
const dotenv = require('dotenv');
dotenv.config({ path: './config/config.env' });
connectDB();

const log = async () => {
const dog = await Dog.findOne({name: "Espresso"});
console.log(dog);
}

log();
Loading

0 comments on commit dbdb5d4

Please sign in to comment.