const mongoose = require("mongoose");
const db = require("../models");

mongoose.connect(process.env.MONGODB_URI || "mongodb://localhost/voyagrdb");

const newPostsSeed = [
  {
    title: "Chichen Itza",
    description:
      "Chichén Itzá is a complex of Mayan ruins on Mexico's Yucatán Peninsula.",
    image: [],
    latitude: 20.6843,
    longitude: 88.5678,
    visitDate: 04 / 01 / 2021,
    userID: "",
    date: "",
    timestamp: "",
    user: "",
  },
];

db.Posts.remove({})
  .then(() => db.Posts.collection.insertMany(newPostsSeed))
  .then((data) => {
    console.log(data.result.n);
    process.exit(0);
  })
  .catch((err) => {
    console.error(err);
    process.exit(1);
  });
