connect mongo to express api
//using mongoose
npm i mongoose
const mongoose = require("mongoose");
mongoose
.connect(
"your mongodb URI",
{
useNewUrlParser: true,
useCreateIndex: true,
useFindAndModify: false,
useUnifiedTopology: true,
}
)
.then(() => console.log("mongodb connected"))
.catch((err) => {
console.err(err.message);
process.exit(1);
});
Also in JavaScript:
- how to add a variable in js
- js know size of screen displayed
- firebase cloud functions send email
- javascript empty function
- if(gender.length === 0) javascript
- javascript object get value by key
- mongodb replace document
- javascript redirect to homepage
- vuelidate require if
- How to remove object from array of objects using JavaScript geeksforgeeks
- how to draw horizontal line in canvas
- DataTables warning: table id=example-dt - Invalid JSON response.
- chrome extension get current tab url
- get select2 selected value
- conditional rendering alert if input fields are empty
- json example array
- News Application With Angular and Material Design
- logical operators javascript
- alert user javascript
- how to Check if an array contains a string
- jquery get src of image
- change color of strike through line of text in react native
- set value of attribute using each and keyup jquery
- ReferenceError: fetch is not defined