Nov 1 · 1 min read
Two main obstacles I faced:
- Newer version of mongoose (5.0+) and deprecation warnings. To avoid, add the following into your server.js file:
const options = {
useNewUrlParser: true,
useUnifiedTopology: true,
useFindAndModify: false
}mongoose.connect(dbRoute, options)
2. Best practice using “===” vs “==” led to outputting a “null” value when getting the id for DELETE and UPDATE methods in App.js. Just using parseInt() did not change the string variable to an integer and the conditional statement was unable to match up the different typed “ids.” I had to place it inside another variable:
Before:
deleteFromDb = (idToDelete) => {
parseInt(idToDelete);
.
.
.
};After:
deleteFromDb = (idToDelete) => {
let deleteId = parseInt(idToDelete);
.
.
.
};Using my local mongo db, I am able to get the app working perfectly! Still waiting for the fix for connecting to MongoDB Atlas.
