Questions tagged [mongoengine]

MongoEngine is a Document-Object Mapper (think ORM, but for document databases) for working with MongoDB from Python. It uses a simple declarative API, similar to the Django ORM.

MongoEngine is a Document-Object Mapper (think ORM, but for document databases) for working with MongoDB from Python. It uses a simple declarative API, similar to the Django ORM.

1823 questions
0
votes
1 answer

How to Reference One to Many in MongoEngine––in the Schema and Aggregate output (Newbie)

I'm trying to output a Class (from the Classes Model) and its referenced Students--to learn mongoengine and mongodb. The below code gives me the error. Expected 'pipeline' to be BSON docs (or equivalent), but got [] I'm sure it's something…
grahama
  • 321
  • 4
  • 13
0
votes
1 answer

APScheduler with mongoengine passing old values in job

I run a APScheduler alongside Flask application with mongoDB. The goal is to run a function in 30 minutes interval, so I run the job like this: scheduler_init.add_job(check_for_expire, 'date', run_date=date_activate_until,…
Alveona
  • 850
  • 8
  • 17
0
votes
0 answers

How to check query return empty object in MongoEngine?

This is the version I used : pymongo 3.9.0, mongoengine-0.18.2, python 3.7.1 I have a simple Document like below: class MyModel(Document): meta = {"collection": "my_model"} name = StringField() email = StringField() address =…
ken
  • 2,426
  • 5
  • 43
  • 98
0
votes
1 answer

UnicodeDecodeError when saving non ascii character to mongo db

Using mongoengine with mongodb when saving document which has value with non ascii character got UnicodeDecodeError (mongoengine wraps values with unicode() call) what's the way to deal with it?
x__dos
  • 1,813
  • 3
  • 27
  • 47
0
votes
1 answer

Django + Legacy MongoDB

I have to use Django with a legacy MongoDB database. I have made the connection but I don't know how to access the documents/data present inside the database? For relational legacy databases, we use inspectdb command and we get references for the…
0
votes
1 answer

How to access system.views written in mongodb using pymongo?

In one of my project, I'm using mongoengine 0.9 and pymongo 2.8 for the database and python django as a framework. I came through the view concept in mongodb and created a view in the database for a model named User. But I don't know how to access…
Vijesh Venugopal
  • 1,621
  • 15
  • 26
0
votes
1 answer

Filter items in mongoengine/mongodb-query by two value of an object inside an array

I want to filter a JSON object (in the collection, called chat) which contains an array of objects. The object contains two values, leaved and user. I want to filter both, so I only get those collection entities where both values match. Example chat…
muuvmuuv
  • 901
  • 2
  • 13
  • 39
0
votes
3 answers

pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [WinError 10061] when trying to do basic MongoDB query

I'm currently trying to implement a user creation & login system in my Flask webapp using MongoDB Atlas (so it's a cloud server which I think makes a big difference for this error), mongoengine, and pymongo (all latest versions as of this post).…
Eli
  • 51
  • 2
  • 7
0
votes
1 answer

How can you query embedded document that is null with mongoengine

I am new to mongoengine and querying. I got a document and an embedded document that looks like the following: class Plan(EmbeddedDocument): name = StringField() size = FloatField() class Test(Document): date = DateTimeField() plan =…
slaayaah
  • 101
  • 1
  • 2
  • 8
0
votes
2 answers

MongoEngine Unexpectantly Changing Field Value

I am trying to simulate a sequence in a mongoengine document class. I have overwritten the init function to find the next contiguous value and am setting it in the document. For some reason the number gets incremented every time I add another object…
Len Wanger
  • 21
  • 1
  • 4
0
votes
1 answer

How to print or log real executed query statements, such as django insert, query and other SQL statements will be logged

How to print or log real executed query statements, such as django insert, query and other SQL statements will be logged。I searched the documentation of both libraries and found nothing about this. I want something similar to django in that I can…
张豪飞
  • 1
  • 2
0
votes
1 answer

Mongoengine how to retrieve filtered subdocuments in an EmbeddedDocumentListField in a collection

I have a document model as follows: class MyDocumentModel(DynamicDocument): subdocuments = EmbeddedDocumentListField(MySubdocumentModel) class MySubdocumentModel(EmbeddedDocument): some_field = StringField() What I want to be able to do is…
Iowa15
  • 3,027
  • 6
  • 28
  • 35
0
votes
1 answer

How to create a Mongo Document Schema for a Recursive Object in Python?

Self-referencing Python object MongoDB Schema What am I trying to achieve? The program I am trying to create handles data describing categories of grocery products, like: Milk, Beef, Corn, Local Fruits and such. I plan on storing this data in a…
0
votes
1 answer

Get number of operations from each X minutes intervals from mongo databbase, Even non operational minutes data also

Hello I have a MongoDB aggregation problem, I want to generate a report of no. of operations done in the database, using aggregation stages $match and $group in match providing intervals $gte & $lte, in group trying to get data of each 15 minutes…
0
votes
1 answer

Mongoengine documents are saved without fields after `switch_collection`

I have a very strange behaviour when saving documents after using the switch_collection method. Can be reproduced using the following code: import mongoengine as me class ObjectA(me.Document): name = me.StringField() def…
Jundiaius
  • 6,214
  • 3
  • 30
  • 43