175,440 questions
0
votes
2
answers
37
views
Can't connect to MongoDB Atlas (free tier)
I'm struggling to connect from my Rails deployment to an Atlas Cluster.
This is my MONGODB_URI:
mongodb+srv://JohnDoe:****@cluster0.*****.mongodb.net/XYZ_prod?retryWrites=true&w=majority
The ...
3
votes
1
answer
69
views
Mongodb timeseries collection can't query far far future records
Mongo can't bring records which are in far far future like 2394-10-20T16:10:23
now: 2025-11-17
Description:
I have a timeseries collection in mongo and here is the command to created it:
db....
Advice
0
votes
1
replies
31
views
Is Mongoid 9 compatible with MongoDB 8.2?
Looking at the compatibility page, MongoDB 8.2 isn't listed as compatible. In practice, I suspect this page is updated less often than it should be, so I wonder if Mongoid is actually fully compatible ...
Best practices
0
votes
1
replies
49
views
Mongodb Using aggregates for advanced search
Trying to solve a conundrum I have in writing some queries.
I’ve traditionally used simple find operations (and cursor operations for paging functionalities), but need something more complex to ...
1
vote
1
answer
46
views
Jest + Testcontainers MongoDB: Intermittent ECONNREFUSED errors running integration tests
Problem
Starting November 10th, my Jest integration tests began failing randomly with MongoDB connection errors. The tests use @testcontainers/mongodb v11.5.1 and mongodb v8.0.12.
Error:
...
1
vote
0
answers
51
views
PySpark/MongoDB Connector DataException: dataType 'struct' is invalid for 'BsonArray' during ETL
I am running a data ingestion ETL pipeline orchestrated by Airflow using PySpark to read data from MongoDB (using the MongoDB Spark Connector) and load it into a Delta Lake table. The pipeline is ...
2
votes
1
answer
77
views
How to combine diacritics-insensitive, case-insensitive and partial search in MongoDB?
I'm trying to implement a robust search function in my NestJS/Mongoose application that can handle partial matches while being case-insensitive and diacritics-insensitive (ignoring accents).
My ...
0
votes
2
answers
51
views
How to correctly type $and operator in MongoDB TypeScript driver without double WithId nesting?
I'm building a strongly-typed generic MongoDB repository in TypeScript (using the official mongodb driver, v6.x).
I want to compose filters dynamically using $and, but the TypeScript type system keeps ...
0
votes
1
answer
44
views
Spark 4.0.1 MongoDB Connector 10.5.0: Missing configuration for: collection and NoClassDefFoundError: com.mongodb.client.MongoClient
I am trying to read data from MongoDB in Spark 4.0.1 using the MongoDB Spark Connector (version 10.5.0). My PySpark code looks like this:
from pyspark.sql import SparkSession
spark = SparkSession....
0
votes
1
answer
100
views
How can I clone objects without retrieving them in MongoDb?
I use MongoDb in C#. Shown below is an object I want to clone, but also I want to merge it into the same collection.
This is a simplified version of the document I use:
class MyDocument
{
public ...
3
votes
2
answers
114
views
MongoDB $regexMatch error: "needs 'input' to be of type string"
I'm getting an error in my mongodb aggregation pipeline with the $regexMatch operator. I'm trying to match fields that contain ISO date strings and convert them to a different format.
Here's the ...
3
votes
1
answer
92
views
Django Mongodb Backend not creating collections and indexes
Summary
Running Django migrations against our MongoDB database does not create MongoDB collections or indexes as defined in our app. The command completes without errors, but no collections or indexes ...
0
votes
0
answers
71
views
mikro-orm - reading entity data by given reference IDs
I'm kind of new to mikro-orm, trying to wrap my head around as how to correctly define
the relations between some of my entties in my collections.
The idea is to store all my pre-defined modules in ...
0
votes
0
answers
53
views
Mongock rollback method is not executed
I have a collection migrationTest in MongoDB with a unique index for the message field.
In my migration I'm inserting documents to this collection and in one place I'm using the existing message to ...
4
votes
2
answers
83
views
Is MongoDB BSON Timestamp signed or unsigned?
The BSON Timestamp type, documented here https://www.mongodb.com/docs/manual/reference/bson-types/, includes a 32-bit time_t field. Does anyone know whether this field is signed or unsigned? If signed,...
3
votes
2
answers
143
views
MongoDB Go driver’s topology view is stale and reports no primary indefinitely
I'm encountering an issue in a Go application that uses the official MongoDB Go driver. We have the use case where a ReplicaSet is recreated from scratch. Replica Set consists of 2 members, no arbiter ...
2
votes
1
answer
71
views
Should I close the DB connection in NextJS
I am new to programming (and NextJS) and I'm building a NextJS app, using Mongoose for my MongoDb connection. I was wondering if I should close the connection after each query? Right now I am just ...
0
votes
0
answers
61
views
NestJS converting mongodb snake case to camel case format but it returns undefined
I'm currently trying to create the model using nestjs mongoose schema, and i want to convert the mongodb data from snake case to camel case in my schema layer like this:
export type ...
0
votes
1
answer
46
views
Mongo unexpected mongo queries
i have some problems in production using mongo
We have python using mongo and mongo-express for ui. And we are facing performance issues, after research i found db.currentOp() to see queries which are ...
1
vote
0
answers
43
views
Watching for changes on an array of a document in a Mongo collection only triggers on the second push, not the first
Say I have a document in a Mongo collection that looks like the following:
{
"_id": "01:550204",
"somefield1": "someValue1",
"somefield2": "...
-4
votes
1
answer
62
views
How to precompute nested date ranges efficiently to optimize range filtering and pagination? [closed]
📝 Body
I have a Mongo collection CollectionA where each top-level object contains a nested array of meetings now each meetings have start and end times, for example:
CollectionA = [
{
&...
0
votes
0
answers
74
views
How to deserialize polymorphic objects in MongoDB?
I am developing a project using Kotlin and the Quarkus framework (version 3.20 LTS), that connects to a MongoDB database, which has already been populated previously with some documents using the ...
2
votes
1
answer
71
views
Mongodb v6.0.16 boost error when building from source with scons: run_it<FutureExecutorContinuationSharedState>' has no member named 'that'
I'm trying to build an older version of Mongod on Arch Linux.
It's required by software called Deadline that I intend to use; Deadline's documentation says the following: "For maximum ...
1
vote
0
answers
37
views
MongoListener (Java) not reading from MongoDB collection on local Docker
I have a MongoDB Docker container, running locally. I have set this up using the following file, docker-compose.yml
services:
mongodb:
container_name: mongodb-local
image: mongo:latest
...
1
vote
0
answers
51
views
Mongodb not available for my AWS Lambda function
I have tried to import mongodb into my lambda function and I keep getting an error message when I attempt to test it. All the recommended resolutions I have seen assume I am working in an environment ...