Skip to main content
0 votes
0 answers
51 views

pymongo is not inserting document with base64 string

I have data which pymongo fails to upload, and, I cannot understand why. Data available here main2.py: from pymongo import MongoClient import json client = MongoClient(host='localhost') db = client....
deostroll's user avatar
  • 12k
0 votes
0 answers
70 views

How can I programmatically determine if a PyMongo command is a read or write for permission logic (without a hardcoded command list)?

I'm building an authorization/access control system in a Python application that uses PyMongo to access MongoDB. I need to dynamically decide—at runtime and for arbitrary query shapes—whether a given ...
GuyEternal's user avatar
1 vote
1 answer
89 views

PyMongo MongoClient - is there a way to see number of open connections?

The docs say that each mongo client maintains a connection pool, the max size of which I can specify. Is there anyway to check the number of open connections made by a specific mongo client at a given ...
Sandil Ranasinghe's user avatar
1 vote
1 answer
201 views

Pymongo and Beanie Incompatibility issues

I'm trying to migrate from motor to pymongo's AsyncMongoClient. After doing some upgrading/installing on pymongo I am having the below error when running this import from beanie import Document ...
Masterstack8080's user avatar
0 votes
0 answers
38 views

How to set timestamp on document update only when it's modified with MongoDB (pymongo)?

Let's say I have a command: my_collection.update_one({...}, { "$set": { "title": "Title 1" } }) How to make it adding update_at field with current date when update ...
Alex Burla's user avatar
1 vote
3 answers
92 views

MongoDB count_documents() returns 19 but find() returns empty list - Replica Set Consistency Issue

I'm experiencing a consistency issue with MongoDB in production. I have a 3-node replica set deployed on OVH, and sometimes count_documents() and find() return different results for the exact same ...
Ryad's user avatar
  • 21
0 votes
0 answers
70 views

Static typing for database schema models that handle foreign keys/dbrefs as `external_document: ExternalDocumentModel | DbRef`

We're using Python (3.12) with Pydantic models to represent schemas for our MongoDB collections, which we then instantiate with SomeModel.model_validate(<results of pymongo query>). We define ...
Gloomy's user avatar
  • 1,529
0 votes
1 answer
44 views

mongo add new properties instead of overwriting existing ones if using dot notation and arrays

i have a mongodb with documents containing a list of "pages", as sub-documents, like { pages: [ { a:1, b: "foo"}, { a:2, b: "bar"}, ] } now i want to update the ...
A. Rabus's user avatar
  • 529
0 votes
1 answer
80 views

mongod db.killAllSessions() reports that it works, but doesn't kill the sessions

I'm very new to MongoDB and I'm trying to get the killAllSessions or one of its variants to work, in mongosh and/or using pymongo. I have a simple, standalone instance of mongod running in a Docker ...
Rodney Lott's user avatar
0 votes
1 answer
86 views

MongoDB: rename a field with dot in it

I have a MongoDB collection that contains several fields with dots, like: { "symbol.name": "Some name" "symbol.state": "Some state" // etc. } Now, ...
Nikolay Kovalenko's user avatar
0 votes
1 answer
43 views

Requesting clarity on PyMongo's maxIdleTimeMS parameter

per the official PyMongo's documentions for maxIdleTimeMS maxIdleTimeMS (optional): The maximum number of milliseconds that a connection can remain idle in the pool before being removed and ...
Srikar's user avatar
  • 14
1 vote
1 answer
48 views

PyMongo - Group by year based on subdocument date

I have a MongoDB document like: [ { _id: ObjectId('67cfd69ba3e561d35ee57f51'), created_at: ISODate('2025-03-11T06:22:19.044Z'), conversation: [ { id: '...
NPatel's user avatar
  • 21.4k
0 votes
1 answer
56 views

Update an array value in document with Pymongo

I am creating a tracker that tracks the usage of invites on discord and who used which invite when a member joins. I am storing the data in mongodb. I am having trouble update the uses value which I ...
user29836029's user avatar
1 vote
0 answers
84 views

Get MongoDB telemetry using Open Telemetry auto instrumentation for flask?

My company runs a Flask API connected to MongoDB on atlas. Currently, we have minimal logging and metrics and rely solely on Altas to monitor DB usage. This month we realized the DB is being queried ...
Lance's user avatar
  • 123
0 votes
0 answers
30 views

Jupyter_dash not loading a dash

I'm doing a project for school that uses an .ipynb file to create a dashboard and connect to a MongoDB collection to output a table and map. The code is here: # Setup the Jupyter version of Dash from ...
Joseph Caron's user avatar

15 30 50 per page
1
2 3 4 5
459