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 orderby on two field getting error

I have more than 20000 documents in mongo and also added the index on date and version and I want to order it by these two fields order_by('-date', '-version') but while ordering it throws this error database error: too much data for sort() with no…
vinay kumar
  • 583
  • 6
  • 18
0
votes
1 answer

Check if Atomic Update was successful

class Parent(Document): list_items = ListField(EmbeddedDocumentField(Child)) class Child(EmbeddedDocument): name = StringField() I have created a function to delete the embedded document from the ListField using the pull - Atomic…
rjcossa
  • 117
  • 4
  • 18
0
votes
1 answer

MongoEngine & Pymongo Error when save (any) document to collection

I receive the following error when trying to save a document to a collection: mongoengine.errors.OperationError: Could not save document (assertion src/mongo/db/storage/mmap_v1/btree/key.cpp:626) The collection (and the db) exists and I've tried to…
Jundiaius
  • 6,214
  • 3
  • 30
  • 43
0
votes
0 answers

django mongoengine unable to login using correct password

I am using mongoengine with django rest framework and default User model: settings.py AUTHENTICATION_BACKENDS = ( 'mongoengine.django.auth.MongoEngineBackend', ) SESSION_ENGINE = 'mongoengine.django.sessions' SESSION_SERIALIZER =…
0
votes
0 answers

Reason for Mongo duplicates

I don't have unique constraint on my collection nor can I add it. On insert, under certain unknown circumstances, mongodb creates duplicate records. Any idea on how and why is this happening?
0
votes
1 answer

Avoid mongodb duplicate documents without using unique index

Link to similar problem (assuming above link provides context) For a very limited duration, Mongodb in my case, receives a lot of connections. During this time-span if any insert happens, multiple duplicate documents get created. Please note that,…
0
votes
1 answer

Using mongodb with class-based view django

I try to use class-based view like below class DetailBookVIew(DetailView): model = Book template_name = 'book/detail_book.html' with model Book is a mongodb model, so how can I use that class-based view with mongodb model, because it will…
Cuongpt
  • 45
  • 2
  • 7
0
votes
1 answer

ViewDoesNotExist at /accounts/register/ (django-registration-me error)

I am currently working on a project which uses mongoengine and django. I am using django-registration-me to handle user registrations, but I am having problems after submitting the new user registration form. The error I am receiving…
Drew Watkins
  • 256
  • 2
  • 8
0
votes
0 answers

pymongo set read_preferences on connect via the config file

ENVIRONMENT_CONFIG_FILE contains : MONGODB_SETTINGS = { 'host': 'localhost', 'port': 27017, 'db': 'my_db' } //in my application app.config.from_envvar('ENVIRONMENT_CONFIG_FILE_LOCATION') MongoEngine(app) supposed I want to set…
WebQube
  • 8,510
  • 12
  • 51
  • 93
0
votes
1 answer

How can I order, limit and filter in a single query using mongoengine

try: keyword = Keyword.objects[:1].order_by('-created_at').get(keyword='myfilterkeyword') except Keyword.DoesNotExist as e: Logger.log(e) For now I do it using the above way. Is this the optimal and right way to do it? Is exception…
cegprakash
  • 2,937
  • 33
  • 60
0
votes
1 answer

MongoEngine does not save field with no error message

I have set up the following model in MongoDB using MongoEngine. class Category(Document): normed_name = StringField(), name = StringField(), path = StringField(), The model was different initially and I did import some documents, but I…
Domronic
  • 149
  • 1
  • 1
  • 11
0
votes
2 answers

MongoDB ReferenceField to JSON

I am writing an API with Flask. I use a ReferenceField for the user who has written a Post. The API should return a JSON object with the data about the post and the data about the user. Flask endpoint: @app.route("/api/posts") def posts_index(): …
Developer
  • 2,113
  • 2
  • 18
  • 26
0
votes
0 answers

python, mongoengine ReferenceField duplicate key error

So I have these models: class Podcast(Document): name = StringField(max_length=200, required=True) category_id = ReferenceField(Category) and: class Category(Document): name = StringField(max_length=120, required=True,…
Sebastian Karlsson
  • 715
  • 1
  • 8
  • 19
0
votes
1 answer

Django & Mongoengine get data from embedded document?

I am having trouble retrieving data from the embedded document in mongoengine. models.py from mongoengine import Document, EmbeddedDocument, fields class ProductFields(EmbeddedDocument): key_name = fields.StringField(required=True) …
Kishan M
  • 173
  • 2
  • 13
0
votes
1 answer

Referencing SQL model in mongoengine model field

I'm using mongoengine in my workout calendar Django project to store workouts with varying fields, depending on which lifts a user has done, how many of them, etc. I have defined a Workout object that represents one workout done by one person at a…
Sahand
  • 7,980
  • 23
  • 69
  • 137