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

Python mongoengine QuerySet returns unexpected values

I have defined dbSMS class on top of mongoengine.Document like this (I imported mongoengine as db): class dbSMS(db.Document): sender = db.StringField(max_length=12, required=True) target = db.StringField(max_length=12, required=True) …
aerilum
  • 1
  • 4
0
votes
1 answer

Django Mongoengine Authentication

I have managed to connect django 2.0 with mongoengine. Every other thing is working fine apart from the authentication part. in my settings.py I have the following: INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', #For…
0
votes
1 answer

Mongoengine insert method is not inserting values in db

I am working on mongoengine with Python3. I am trying to save one user at atime. Users.objects.insert(user, load_bulk=False) Printing this is giving me and ObjectId but still I am not able to see insert data in database.
0
votes
1 answer

Delete all information from document but persist it's ObjectId, mongoengine

I need to delete all information but to persist objectId, because it can be referenced to outside my function (so just clear all fields, do not recreate) I've heard i can do it with update() with no args or something like that. Of course i can do it…
B. Semchuk
  • 1
  • 1
  • 9
0
votes
1 answer

In Mongoengine, how to have an embedded document with a reference to the parent document type^

I am developping an API in Python with Flask and Mongoengine. I want to have the following structure: class FactionRelationship (Document): faction = ReferenceField('Faction') relationship = IntField() class Faction (Document): name =…
Chapeau
  • 1
  • 1
  • 3
0
votes
1 answer

Tkinter entry box values stored as null in mongodb

I've made a simple registration form using tkinter and mongoengine.But due to some reason, the value grabbed from tkinter entry boxes are stored as null or empty in mongodb.I guess the problem is that the variable is not able to grab the value…
Endemic
  • 370
  • 1
  • 2
  • 15
0
votes
1 answer

"You have not defined a default connection" with Elastic Benstalk WSGI Deployment of Flask application with mongoengine

I am stuck with first time deployment of flask application on Elastic Beanstalk. It fails establishing connection to mongodb with a error "mongoengine.connection.MongoEngineConnectionError: You have not defined a default connection".…
0
votes
0 answers

Delete specific value from Embedded document using Mongoengine when in Embedded Document List Field

I have a two classes in Mongoengine that looks like that: class User(Document): user_id = StringField(required=True) date_modified = DateTimeField(default=datetime.datetime.utcnow()) profile_link = URLField() email = EmailField() first_name =…
0
votes
2 answers

Can't figure out update many on mongoengine

This code is returning an error that I don't understand: query = Analytic.objects(uid__type="binData") analytics = [] for analytic in query: analytic.sessionId = str(analytic.sessionId) analytic.uid = str(analytic.uid) …
Badjano
  • 418
  • 7
  • 23
0
votes
0 answers

Connect django+mongoengine to remote mongodb

I have a web app written in Django with mongoengine in a Digital Ocean droplet. During the developing step I used a sample of the main database that is located in a remote enviroment. But now I want to connect the Django web app to the main MongoDB…
Miguel
  • 2,738
  • 3
  • 35
  • 51
0
votes
1 answer

Django Rest Framework Mongoengine - PUT/PATCH vs GET for ReferenceField

I have two mongoengine Document models as: from mongoengine import * class Doc1(Document): doc1_field1 = StringField(max_length=100) doc1_field2 = StringField(max_length=100) class Doc2(Document): doc2_field1 = ReferenceField(Doc1) …
unicorn
  • 139
  • 1
  • 9
0
votes
1 answer

Mongoengine - Query to get matching documents with a field value null or that do not contain the field

I have users collection from this collection I need to fetch all the matching documents that either contain the name field whose value is null or that do not contain the name field. I have tried a couple of ways but I did not get the expected…
Sandeep
  • 13
  • 4
0
votes
1 answer

Adding items to list of ReferenceField in mongoengine

I have the following structure of my collection in mongo. class SkillCluster(DynamicDocument): Name = StringField(required=True, unique=True) SubClusters = ListField(StringField()) ModifiedDate = DateTimeField(default=datetime.utcnow) …
Anurag Sharma
  • 4,839
  • 13
  • 59
  • 101
0
votes
1 answer

How Can I Store and serve an image in Django Rest Framework using Mongoengine (Mongodb module for Django)

here is my models.py : models.py class Resource(Document): instruction = fields.StringField(required=True) picture = fields.ImageField(required=False) and my serializer : class ResourceSerializer(serializers.DocumentSerializer): …
0
votes
0 answers

Mongoengine custom save for collections with unique indexes

Here's what I want to do: Toss a new document at the DB and have it throw back an updated existing document if there's a match (based on some or all of the uniqueness constraints). I have a collection of companies: class Company(DynamicDocument): …
Joe Walsh
  • 396
  • 3
  • 6