1,821 questions
0
votes
0
answers
43
views
extended mapfield results in error when updating a doc - mongoengine
I am trying to write an enhanced field for mongoengine mapfield where it takes a defined enum and tracks the selection. Ideally, it locates and presents the enum when in python but saves the defined ...
1
vote
1
answer
206
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
...
0
votes
0
answers
43
views
Using pytest and mongoengine, data is created in the main database instead of a test one
I've installed these packages:
python -m pip install pytest pytest-django
And created a fixture:
# core/services/tests/fixtures/checkout.py
import pytest
from bson import ObjectId
from datetime ...
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 ...
1
vote
1
answer
40
views
MongoEngine library doesn't allow to use its BaseFields for persisting data
I started to use mongoengine library in order to read and write data from Mongo DB.
I found some strage behavior. The following class is defined in my codebase:
class CustomerRequest(BaseModel):
...
0
votes
0
answers
28
views
Query a Mongdb collection for documents which contain a dictionary of specific keys
How does one query a DictField to see if the keys contain a specific string. Originally the dictionary was used as it was easier to query or elements further in the tree. However, when expanding I ...
0
votes
0
answers
50
views
Consistent DateTime datatype when using both PyMongo and flask mongoengine
I am trying to maintain a consistent datatype for my datetimes in a Mongo collection, where some come from PyMongo, and others come from flask-mongoengine.
In Flask, the relevant model entry is:
...
0
votes
1
answer
25
views
Check if email in ListField of EmailField inside jinja2 template
Context:
I have a class as follows:
class DisplayArtwork(Document):
name = StringField(required=True)
email = EmailField(required=True)
country = StringField(required=True)
phone = ...
0
votes
0
answers
15
views
django/mongoengine loses connection alias after running awhile
I have a SaaS app built with django rest framework. Due to some contract requirements, each client's data has to be stored separately (on the same DocumentDB cluster but separate database). Each API ...
0
votes
1
answer
22
views
building a dynamic query for mongoengine
I am trying to interface with mongoengine and extract out posts based on different inputs. At first I was simply running a for loop with a modulatory query and running said query every time. However ...
0
votes
0
answers
19
views
perform a general search in a mongoengine document to find instance of a particular value
I have a created a database in mongodb and setup mongoengine in python to interface with it. The next step is to setup a query which will go through the documents and search for specific values. I ...
1
vote
0
answers
27
views
mongoengine contains and exists in the same query
Is it possible to have a contains and exists call in the same query in mongodb, specifically mongoengine for python?
The data I need to parse is stored in a mapfield where I need to go into the keys ...
0
votes
1
answer
52
views
python & mongoengine, How do I map data to datetime?
I am trying to store temporal data in mongodb with the use of mongoengine. As the date of the data is a primary component, I thought it would be best to map the data to the date. However, when ...
2
votes
1
answer
125
views
How to make a field read-only in a `mongoengine` Document while allowing conditional updates?
I have a mongoengine document such as:
from mongoengine.document import Document
from mongoengine import StringField
class Class_A(Document):
field_a = StringField()
field_b = StringField()
...
0
votes
1
answer
43
views
Manual Migration of an existing DB to MongoEngine doesn't populate fields
I have an existing database of data that I want to use with MongoEngine. I updated the class as follows:
class World(Document):
user = ReferenceAttr(choices=["User"], required=True)
...