Category "mongoose"

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

Document Read and insert with locking/transaction in nodejs with mongodb

In reservation system, only 5 different user can create bookings. If 100 user call booking api at same time than how to handle concurrency with locking. I am us

Querying with mongoose: how to parce a Mongo _id?

I found this similar question to mine, but without explanation Mongoose find query vs $match, I'm trying to do something similar. I manage to filter by today's

Mongoose - array of enum strings

I have a Schema that has a property with the type of array of strings that are predefined. This is what I've tried to do: interests: { type: [String], e

How can Add two different field which type is ObjectId in same object which refer same schema

const ChatSchema = new mongoose.Schema({ username: { type: String, }, mobile: { type: Number, }, friends: [ { type: mongoose.Schema.

Getting no overload matches this call running mongoose with typescript and express

I am getting the below error for useNewUrlParser, useUnifiedTopology, useCreateIndex: No overload matches this call. Overload 1 of 3, '(uri: string, callback:

Connecting to mongoDB(/mongoose) from a website?

I'm creating a website, and currently for a feature I need it to connect to my mongoDB database, is there any way to do this? As far as I've seen it's not possi

Mongoose Error: "useCreateIndex" is not supported but documentation still has it

This is frustrating. No clues why I got this error while documentation still has it. Please help! My code to connect MongoDB with mongoose. const mongoose = req

Can't get Data while fetching from React Error(304)

While i'm using axios to fetch data it's return 304 on React . But it's work on Postman ! const [mangas, setMangas] = useState([]) useEffect