Category "mongodb"

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

Poor Write perfomance with MongoDB 5.0.8 in a PSA (Primary-Secondary-Arbiter) setup

I have some write performance struggle with MongoDB 5.0.8 in an PSA (Primary-Secondary-Arbiter) deployment when one data bearing member goes down. I am aware of

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

Searching numbers as keywords or strings with Mongo Atlas Search (as possible in Elastic Search)

Sometimes it's useful to allow numbers to be treated as keywords or strings when using a search index. For example, suppose I have transaction data something li

How to update exists value (type: string) to array of ojbect and object in mongoDB?

I have following documents: [ { "_id": "6245131fdbcda3639d75c951", "username": "joy", "description": "description english", "product_code_orig

MongoDB - ReplicaSet - Failed to refresh key cache

I am deploying my first replica set on a Windows 10 machine with MongoDB 5.0. For the purpose of the tutorial, I want all the servers running on my machine, on

I'm trying to connect monogoDB with node.js, but the terminal is showing MongoAPIError: URI must include hostname, domain name, and tld

I'm trying to connect MongoDB with node.js, but the terminal is showing MongoAPIError: URI must include hostname, domain name, and tld Backend Code I have writt

Mongodb query with multiple $or inside $and

I want records which if type have 0 or 2 than status should not equal to 0 and if type = 3 then ignore status. I tried this way but not working. db.activities.f

Mongo DB Service is stopped automatically on frequent basis from Services

Mongo DB is called in every 1 minute to insert data. and in between this process, the Mongo DB service is auto-stopped frequently.

Connection to monitor closed MongoDB

I am trying to run my discord bot but I get this error [12/4/2021, 2:06:02 AM] - [INFO] - [ShardManager] Started 1 shards [12/4/2021, 2:06:28 AM] - [ERROR] - co

Zsh: Command Not found : mongo After trying to install mongodb 4.2 using brew

I have tried the following steps to install and setup mongodb in my mac from here https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/ but I got th

Find in which polygon certain coordinate (latitude, longitude) lies with MongoDB?

Let's say 100 documents (so to say polygons) in a collection named Areas with this structure: { ...otherFields, commonName: "Butwal", area: { type: "

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

Is there a way to perform subquery on MongoDB using collection.aggregate() and PHP Driver?

I am migrating a MySQL table which has 50 million+ rows and 40 columns to a MongoDB database. This table data is shown on a html table and every column is searc

Read-only file system when attempting mkdir /data/db on Mac [closed]

I am trying to create a new folder in the main directory Tried all kinds of examples sudo mkdir /data/db sudo mkdir -p /data/db I keep

Rust update mongo document

I'm trying to update my document, if I don't pass a field it is being deleted. my document is { "_id":"27fc47a4-0730-446c-8acd-41aa6e227406", "user_id":"a

MongoDB - Group by inner element

I am explaining with a simple example see my MongoDB collection looks like this: [ { pid: erwer, qty: 3, LevelDetails: {

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