|
1 | | -const mongoose = require("mongoose"); |
2 | | -const path = require("path"); |
3 | | -require("dotenv").config({ path: path.resolve(__dirname, "../.env") }); |
| 1 | +//Commented full file because no MONGO_URI available for testing server |
4 | 2 |
|
5 | | -// console.log(process.env.MONGO_URI); |
6 | | -mongoose |
7 | | - .connect(process.env.MONGO_URI, { |
8 | | - // options for the connect method to parse the URI |
9 | | - useNewUrlParser: true, |
10 | | - useUnifiedTopology: true, |
11 | | - // sets the name of the DB that our collections are part of |
12 | | - // dbName: 'swell' |
13 | | - }) |
14 | | - .then(() => console.log("Connected to Mongo DB.")) |
15 | | - .catch((err) => console.log(err)); |
| 3 | +// const mongoose = require("mongoose"); |
| 4 | +// const path = require("path"); |
| 5 | +// require("dotenv").config({ path: path.resolve(__dirname, "../.env") }); |
16 | 6 |
|
17 | | -const Schema = mongoose.Schema; |
| 7 | +// // console.log(process.env.MONGO_URI); |
| 8 | +// mongoose |
| 9 | +// .connect(process.env.MONGO_URI, { |
| 10 | +// // options for the connect method to parse the URI |
| 11 | +// useNewUrlParser: true, |
| 12 | +// useUnifiedTopology: true, |
| 13 | +// // sets the name of the DB that our collections are part of |
| 14 | +// // dbName: 'swell' |
| 15 | +// }) |
| 16 | +// .then(() => console.log("Connected to Mongo DB.")) |
| 17 | +// .catch((err) => console.log(err)); |
18 | 18 |
|
19 | | -// sets a schema for the 'bookSore' collection |
20 | | -const bookStoreSchema = new Schema({ |
21 | | - title: { |
22 | | - type: String, |
23 | | - required: true, |
24 | | - }, |
25 | | - author: { |
26 | | - type: String, |
27 | | - required: true, |
28 | | - }, |
29 | | - pages: { |
30 | | - type: Number, |
31 | | - required: true, |
32 | | - }, |
33 | | -}); |
| 19 | +// const Schema = mongoose.Schema; |
34 | 20 |
|
35 | | -// creats a model for the 'bookStore' collection that will be part of the export |
36 | | -const BookStore = mongoose.model("bookStore", bookStoreSchema); |
| 21 | +// // sets a schema for the 'bookSore' collection |
| 22 | +// const bookStoreSchema = new Schema({ |
| 23 | +// title: { |
| 24 | +// type: String, |
| 25 | +// required: true, |
| 26 | +// }, |
| 27 | +// author: { |
| 28 | +// type: String, |
| 29 | +// required: true, |
| 30 | +// }, |
| 31 | +// pages: { |
| 32 | +// type: Number, |
| 33 | +// required: true, |
| 34 | +// }, |
| 35 | +// }); |
37 | 36 |
|
38 | | -// exports all the models in an object to be used in the controller |
39 | | -module.exports = { |
40 | | - BookStore, |
41 | | -}; |
| 37 | +// // creats a model for the 'bookStore' collection that will be part of the export |
| 38 | +// const BookStore = mongoose.model("bookStore", bookStoreSchema); |
| 39 | + |
| 40 | +// // exports all the models in an object to be used in the controller |
| 41 | +// module.exports = { |
| 42 | +// BookStore, |
| 43 | +// }; |
0 commit comments