Category "mongoose"

Specifying a port in MongoDB URI does not allow me to connect to my local DB

I am testing a connection to a local DB using mongoose and mongodb. Whenever I specify a port when passing in the URI to mongoose.connect() I get a connection r

Querying Views with Mongoose (and encapsulating documents fields)

I use mongodb views to encapsulate data in a Data Transfer Object. After the first run of the code below the view is created in the database. Subsequent executi

Querying Views with Mongoose (and encapsulating documents fields)

I use mongodb views to encapsulate data in a Data Transfer Object. After the first run of the code below the view is created in the database. Subsequent executi

Cannot read properties of undefined (reading 'path') - Multer Error

I am uploading an image to a folder in uploads via multer package. I am getting an error while testing the route in POSTMAN. location_model.js const util = requ

How to skip a document from retrieving in MongoRepository if it causes an error?

I'm working on a web application built using SpringBoot as backend and MongoDB as DBMS. I'm showing all the latest posts in a web page. In the PostRepository.kt

How would I able to get search results in elastic search using mongoosastic?

I am trying to use mongoosastic search() but it doesn't give me the result. Data is saved in MongoDB as well as elasticsearch. Below is the mongoose schema cons

Why it's going in else part even there is value in document that satisfying the if condition?

I want to count total number of Documents with same value for details.iseligible.value, i.e if there is two 'Yes' for details.iseligible.value then count for 'Y

Docker Compose MongoDB docker-entrypoint-initdb.d is not working

I am using following docker-compose file version: '3.7' services: db_container: image: mongo:latest restart: always environment: MONGO_INITDB_ROOT_

Use req.user instead of User.findOne when updating MongoDB sub-documents?

I am using Passport.js for Express, which already holds the current user in the session variable req.user. Yet when I try to update a MongoDB database I can onl

Use req.user instead of User.findOne when updating MongoDB sub-documents?

I am using Passport.js for Express, which already holds the current user in the session variable req.user. Yet when I try to update a MongoDB database I can onl

Strength parameter in collation not woking in in Mongoose

I would like to use mongoose in order to send a query to get data but it has to be case insensitive. I'm doing this: model.find({ name: /etoile/i }).sort({ po

NestJS and Mongoose find by reference object Id

I have a Mongo collection of Users and a collection of Addresses. Each address is owned by one user.Here are my schema classes: export type UserDocument = User

What is mean by +srv in mongoDb connection string

I am new to MongoDB and just encountered two types of connection string. mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[datab

How do I use google cloud storage as a bucket to store user/client images in a MERN Stack app?

I'm working on a pretty vanilla boilerplate blog-style application using mongoDB, express, react and node. It allows for user registration, authentication, for

Too much MongoDB connections when running Node.js mongoose app in Google Cloud Run

I am running a Node.js API connecting to MongoDB Atlas with mongoose. The Node.js API runs on Google Cloud Run. I open one connection using mongoose mongoose.co

Mongoose - Update an object inside nested array

My Mongo schema looks like this, I want to update a flashcard object located in an array of flashcard also located in an array of subject. const classrooms = ne

MongoDB query to find top store from list of orders

I'm pretty new to Mongo. I have two collections that look as follows. Order collection [ { id: 1, price: 249, store: 1, status: true

Mongoose calculating average from another collection

I am new to MongoDB/Mongoose. I am trying to do a search based on a key string for a 'Resource' which will return a list of resources based on average of rating

Mongoose - find object and delete objeto inside array

I have this document : [ { "_id": "626c5fd2aa0fc0e4eef45c94", "productos": [ { "_id": "626d50b621180e291a330333"

Aws documentdb MongoServerError: Authorization failure while connecting using mongoose

error: [nodemon] starting `node server.js` app listening on port: 5600 /home/ubuntu/cnox-webbackend/node_modules/mongodb/lib/cmap/connection.js:203