-
Notifications
You must be signed in to change notification settings - Fork 0
/
seeds.js
39 lines (32 loc) · 1.48 KB
/
seeds.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const mongoose = require("mongoose");
const Office = require("./models/Office");
const Review = require("./models/Review");
let offices = [
{name: "LYCS Architecture", image: "https://images.unsplash.com/photo-1531973576160-7125cd663d86?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop", description: "Description 1"},
{name: "S O C I A L . C U T", image: "https://images.unsplash.com/photo-1542089363-bba089ffaa25?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1650&q=80", description: "Description 2"},
{name: "Crew Collective & Café", image: "https://images.unsplash.com/photo-1498409785966-ab341407de6e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1650&q=80", description: "Description 3"}
];
function seedDB(){
Office.remove({});
// .then(()=>{
// console.log("Database was dropped")
// offices.forEach(seed => {
// Office.create(seed)
// .then( (office) => {
// console.log("office was added");
// Review.create({
// text: "That office is so bad",
// author: "Artem"
// }).then(review => {
// office.reviews.push(review);
// office.save();
// console.log("new review was created");
// }).catch(err => {
// console.log(err)
// });
// }).catch(err => {console.log(err)});
// });
// })
// .catch(err=>{console.log(err)});
}
module.exports = seedDB;