175,312 questions
Best practices
0
votes
3
replies
34
views
How to prevent DuplicateKeyException when using MongoDB upsert with optimistic concurrency (versioning)?
I'm using MongoDB with the .NET driver and trying to implement an optimistic concurrency pattern with versioning using UpdateOneAsync and IsUpsert = true.
Here is my code:
public Task UpsertAsync(User ...
0
votes
0
answers
49
views
MongoDB Node driver heartbeat fails on replica set advertised host in Docker, while direct container connection is stable
I have a Node.js application using Mongoose against a single-node MongoDB replica set running in Docker.
Environment:
My application connects with a seed URI like this:
const dbURI = `mongodb://user:...
0
votes
0
answers
56
views
How to prevent Entity Framework Core from using Table-Per-Hierarchy (TPH) mapping
I use MongoDB.EntityFrameworkCore.
I have 3 classes: Pod, Planet, Asteroid with inheritance from SpaceObject
I want use the default Table-Per-Hierarchy (TPH) mapping for Planet and Asteroid to save ...
-1
votes
1
answer
38
views
Client Key requirement for the --tlsCertificateKeyFile mongosh version 2.8.1
I am using a mongosh version 2.8.1 to login to a mongodb cluster. I have an encrypted private key which is legacy‑encrypted PKCS#1. My tlsCertificateKeyFile content includes this:
1:-----BEGIN ...
0
votes
0
answers
23
views
NestJS/ExpressJS MongoDB Atlas connection fails with querySrv ECONNREFUSED _mongodb._tcp unless DNS servers are manually set [duplicate]
I'm having trouble connecting my NestJS/Express application to MongoDB Atlas.
When attempting to connect, I repeatedly get the following error:
Error: querySrv ECONNREFUSED _mongodb._tcp.<cluster-...
Advice
0
votes
3
replies
51
views
Difference between MongoDB and MongoDB altas
I am a learner and right now at Database thing and choose MongoDB to learn as my stack is MERN so, but I am very confused about what MongoDB actually is and is MongoDB Atlas part of it or is it the ...
Tooling
0
votes
2
replies
42
views
Version/Code Error on MONGO ATLAS/CONNECT
So My Doubt is,
I have installed '[email protected]' Version on Mongodb atlas,
I have also checked its data storage capabilities which works fine
But as i am trying to run my code its Showing
"...
-4
votes
0
answers
36
views
Stream processor sometimes take more than one minute to replicate data (cold start?) [closed]
We have a MongoDB Atlas Stream Processor that replicates a collection from one database to another on every document change. It works reliably with no errors, but latency is inconsistent: most of the ...
3
votes
3
answers
122
views
MongoDb .NET to replace string in array using ElemMatch()
I'm using the MongoDb .NET driver (v3.7) to replace string in array using ElemMatch to match the array string element.
All examples I see regarding ElemMatch() involve matching an object in an array (...
0
votes
0
answers
103
views
Issue resolving dependencies with Maven in intellij
I have been trying to get the demo from mongodb's website for their Java driver to compile and I managed to do so last night; however when I launched my ide after work today to get started on the ...
Advice
1
vote
1
replies
66
views
Which BSON types are coerced into each other by operators?
I'm interested in learning more about how MongoDB implicitly converts between BSON types.
So far, I found:
In which order are BSON values of different types sorted
$gt & co silently convert ...
2
votes
1
answer
108
views
MongoDB crashes after a minute [closed]
I'm running MongoDB from this docker-compose file:
services:
mongo:
image: "mongo:8.0.6"
ports:
- "27017:27017"
After ~1 minute, MongoDB crashes. Here are the full ...
-1
votes
1
answer
61
views
Mongo-CXX Build problem using MSYS and MingW
I'm using msys and Mingw64 to build mongo-cxx using cmake , I already have mongo-c shared libs installed (built earlier)
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=17 -DCMAKE_PREFIX_PATH=...
Advice
0
votes
1
replies
59
views
CPU regression in MongoDB for find operations with $in and deep projections
I've encountered a critical performance issue in MongoDB 8.0.15 - 8.0.20. I need your help diagnosing and finding a solution.
After upgrading from version 8.0.14 to any of the versions 8.0.15 - 8.0.20,...
1
vote
1
answer
60
views
mongodb: Does using`$expr:{$lt:[{$size:"$members"},3]}` in a MongoDB update prevent race conditions?
I have a MongoDB collection where each document contains an array field members. I would like to enforce a maximum array length of 3 when adding a new element. One approach I am considering is the ...