Open RajiDurai opened 3 months ago
The above install doesn't work. So choosing homebrew was successful Source : link
To start mongo service, use brew services start mongodb/brew/mongodb-community
To access mongo shell, use mongosh
. (Note. command 'mongo' doesn't work after version 6)
run db.getMongo() method to return the connection string in your local
Mongo-db video tutorial : https://www.youtube.com/watch?v=B86Gw3kiA0M&list=PLFub7_BptrW8chs-qC-BsPIHH7Xe3_5Ib&index=4
install dependencies for mongo in node - npm i mongoose
The below model is successfully set up const customerSchema = new mongoose.Schema({ firstName: {type: String, required: true}, lastName: {type: String, required: true}, companyName: {type: [String], required: true}, }, {collection : 'Customer'});
with below connect params
const conParams = { useNewUrlParser: true , dbName : 'customerSchema'};// added here dbName after 5 hrs scratching my head mongoose.connect(process.env.DB, conParams);
Done
install mongo db