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

MongoEngine filter for date column

I am trying to use MongoEngine to apply a filter on a mongodb collection called Employees. The filter is based on country, city and join_date. The filter condition is that the number of months obtained by subtracting join_date from today's date…
SirG
  • 369
  • 4
  • 16
0
votes
1 answer

Is there a way for automatic ODM for MongoDB in Python?

Is there any way to have out-of-the-box, automatic ODM for Python and MongoDB? For Java the MongoDB driver does everything: I can just dump object of my custom class and load it later, the driver does automatic type checking, mapping etc., I don't…
qalis
  • 1,314
  • 1
  • 16
  • 44
0
votes
1 answer

MongoDB querying aggregation in one single document

I have a short but important question. I am new to MongoDB and querying. My database looks like the following: I only have one document stored in my database (sorry for blurring). The document consists of different fields: two are blurred and not…
slaayaah
  • 101
  • 1
  • 2
  • 8
0
votes
1 answer

Mongoengine change document structure

I'm trying for the first time to use mongo, and I choose mongoengine. After defining the Document structure if I try to change it (adding a field, removing a field, renaming ecc..) the reading operations still works, but any other operation on…
kappa
  • 1,559
  • 8
  • 19
0
votes
1 answer

Query a exisiting collection by using mongoengine

I am trying to access/query an existing collection in mongo via the following code but i get 0 count even though there are 33 documents in the collection! from mongoengine import * class TASK(DynamicDocument): pass connect("try",…
pa1
  • 778
  • 3
  • 11
  • 26
0
votes
1 answer

I'm not able to perform validation for the input data in my mongoengine model class

class TextBoxValues(DynamicDocument): entity_id = StringField(max_length=200, required=True) textbox_type = StringField(max_length=1000, required=True) regexp = re.compile('[A-Za-z]') entity_value =…
Anonymous
  • 55
  • 7
0
votes
1 answer

Change Document 'objects' property to 'query'

I'm trying to change the document 'objects' property to 'query'. It's more intuitive since one is querying the database. Like; Collection.query.find() Instead of; Collection.objects.find() I have tried setting a query attribute to my Collection…
0
votes
0 answers

How to display an image/pdf file stored in mongodb in browser using flask?

can anyone help me to display an image or pdf file stored in mongodb with a flask app to the browser? Currently, when I try, I get a 200 response but the browser is just blank. This is the function I use: My mongo document is modeled like…
0
votes
2 answers

How to use postman to upload DBRef data in json?

I'm trying to post data to mongodb using postman but I don't know the proper convention for uploading the reference to a image file in the fs.files bucket. Basically, the file is already in the database, I'm just trying to post a new user with the…
0
votes
2 answers

How to push or pull multi value of array in MongoEngine or pymongo?

Here is a document(name is Word) example: { "id":"xxxxxxxx", "words":["hello","world","cat","dog","word1","word2"] } now I have a word list contains some words, for example: ["friend","hello","world","stack","question"] I have 2 operation (Every…
McCree Feng
  • 179
  • 4
  • 12
0
votes
1 answer

How to configure djongo for production with admin account?

I managed to get djongo working in my local computer but when I push it to production, I need to set up an admin account for mongo so that my DB doesnt get hacked (again, sigh). Ive searched for a solution for a couple of days, without success. This…
0
votes
1 answer

json.dumps generates a string and returning it as dict is making a string inside another string, how to avoid it and get just a single string

class_object = ModelClass(title=entity_object['title'], entities_definition_key=entity_object['entities_definition_key'], orderId=entity_object['orderId'],uid = json.dumps( uuid.uuid4(), …
Anonymous
  • 55
  • 7
0
votes
1 answer

Mongoengine database relations and connected fields

import mongoengine def global_init(): mongoengine.register_connection(alias="core", name="project") class Worker(mongoengine.Document): username = mongoengine.StringField() salary_per_hour = mongoengine.FloatField() …
Berkin Anık
  • 133
  • 8
0
votes
1 answer

Manage Multiple Params with GET Flask restful MongoEngine Clean Code

I'm creating an API with flask_restful, and I want to search for example with two parameters that will be passed by GET, tag and author. with the code below I can do this. However, it's necessary that I should pass the two parameters. I want…
Simone
  • 813
  • 8
  • 21
0
votes
1 answer

Best Way to Query inside ListField

I have the following code using MongoEngine: class Comment(EmbeddedDocument): content = StringField() name = StringField(max_length=120) class Post(Document): title = StringField(max_length=120, required=True) author =…
Reza
  • 1,945
  • 1
  • 9
  • 17