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 nodename nor servname provided, or not known

I am trying to connect to my heroku mongo database. My connecting URL looks like this I've replaced my actual username/password in the example below. mongodb://username:password@ds135522.mlab.com:35522/heroku_brpg2n9r I then have my config set up…
Biplov
  • 1,136
  • 1
  • 20
  • 44
0
votes
0 answers

Delete a list item from an Embedded Document MongoEngine

I'm having trouble to find the way to delete a list item inside an Embedded document using mongo engine. Document structure: { "_id" : "id", "user" : ObjectId("xxxxxxx"), "invoice" : false, "coupon" : ObjectId("xxxxxxx"), "date"…
0
votes
1 answer

mongoengine attribute error when referencing field in a function - python

Running into an Attribute error on the code below: from mongoengine import * import datetime from bson import ObjectId class Doc_1(EmbeddedDocument): criteria_id = ObjectIdField(default=ObjectId) field_name = StringField() …
pb3975
  • 9
  • 1
0
votes
2 answers

How to query PointField - MongoEngine

I was trying to update PointField in my flask app with upsert_one. But it always inserts new document. I know the problem is with the query which I'm passing. Below is my model. class Location(db.Document): location_name =…
James
  • 2,874
  • 4
  • 30
  • 55
0
votes
0 answers

MongoEngine EmbeddedDocument query with array value

I have an object that looks something like this in the database, with corresponding MongoEngine models: { ... "config" : { "inner_group" : { "individuals" : [ { "entity_id" : "54321", …
Felipe
  • 10,606
  • 5
  • 40
  • 57
0
votes
1 answer

mongoengine cannot use collection in response

[EDITED] I have any api using flask + connexion (swagger 2.0) Any time I retrieve a collection from the database, using simple code such as: # GET /api/model def get_all_model(): return Model.objects I get the following error: TypeError:…
Felipe
  • 10,606
  • 5
  • 40
  • 57
0
votes
0 answers

connecting to mongodb using mongoengine on Heroku

I have a Flask app that I am deploying to Heroku that I want to connect to a MongoDB instance using mongoengine. It looks like this: if __name__ == '__main__': mongo_host = os.environ.get('MONGODB_URI') connect(alias='default',…
stoebelj
  • 1,536
  • 2
  • 14
  • 31
0
votes
0 answers

Serializer object has no attribute '_writable_fields'

I have started writing an app in django with mongodb (my first time). But I'm getting this error related to my DRF-mongoengine serializer. The error reads: AttributeError: 'UserSerializer' object has no attribute '_writable_fields' Full Traceback…
0
votes
0 answers

Unable to connect to MongoDB from a Django containorized app

I'm writing an application with django and I want to use mongoDB as my database. But I am unable to connect to it. The error I get is: ConnectionFailure: [Errno 111] Connection refused My settings for Connection are: import…
Farhat Nawaz
  • 202
  • 5
  • 20
0
votes
1 answer

Avoiding repeated names in JSON with MongoEngine - Python

I'm looking for a way/function/method to make it impossible to save two identical names on my JSON, for example, I got this JSON with repeated names: [ [ { "id": "59a5c80dc75969297837c51e", "name": "uza", "password":…
0
votes
2 answers

Sorting price in mongodb

I'm having trouble sorting data by price. I want to show off the price based on the value of the price I've tried, but the results are not as I expected. code testing: from pymongo import MongoClient client = MongoClient().ecome col =…
Siska Brilian
  • 61
  • 1
  • 4
0
votes
1 answer

What's the differenct among Model.objects, Model.objects(), and Model.objects.all() in mongoengine?

Just as title described.When we have a mongoengine model as below: class Model(Document): some fields definition~~ And I added some items to the database by the Model, when I want to traversal all items, there are three ways, and which…
zhangqy
  • 853
  • 7
  • 10
0
votes
1 answer

Django with MongoDB can't get django admin panel?

Is it true that it's a bad choice python with non-relational database like MongoDB ? I heard if i use mongoDB as my database in my djanog project i can't use default admin panel of django in my projects as it's designed with Relational database m…
sheikhsalman08
  • 387
  • 1
  • 9
  • 18
0
votes
1 answer

Python3 Flask Model Class Init

I can't find out how to init a Model class ... # Define mongoengine documents class User(db.Document, UserMixin): name = db.StringField(max_length=75,primary_key=True) email = db.EmailField(max_length=255,unique=True,required=True) …
Simply Seth
  • 3,246
  • 17
  • 51
  • 77
0
votes
1 answer

MongoDB: Get latest 10 items in different data model?

I'm trying to do a personal blog system with MongoDB. The blog system designed to support both formal article and short tweets, which have similar but different data structures. For example, an article must have a title, but tweets must not; both…
raaay0608
  • 105
  • 9