Questions tagged [djongo]

For usage with the djongo backend driver for MongoDB with the Django framework

Djongo allows you to use MongoDB as the database back end with the Django framework.

The project can be found on GitHub:

https://github.com/nesdis/djongo

274 questions
2
votes
2 answers

Field 'id' expected a number but got ObjectId

I'm studying djongo and i'm trying to create a platform that automatically assign a random amount (between 1 and 10) bitcoins to all new registered users. My code is following: #views.py def register_page(request): if…
Aokami
  • 35
  • 1
  • 6
2
votes
1 answer

Docker-compose django+mongo app stuck at "Performing system checks..."

Running a django app with mongodb using djongo. This is the docker-compose file: version: '3.1' volumes: mongo: services: mongodb: image: mongo restart: always volumes: - 'mongo:/data/db' ports: - 27017:27017 …
Satwato Dey
  • 21
  • 1
  • 2
2
votes
0 answers

How to find by ObjectId Django, MongoDB

How to find by ObjectId (id field) record = Record.objects.filter(_id=id).first() -> None record = Record.objects.get(_id=id) -> Error DoesNotExists
2
votes
6 answers

How do i Fix django.db.utils.DatabaseError

How do i fix Django Database error. I'm using MongoDB with Djongo. Everything was working fine until recently when i decided to add NewApp. Whenever i try to migrate it greets me with django.db.utils.DatabaseError . I tried reseting the DataBase…
orynnnnn
  • 101
  • 3
  • 13
2
votes
1 answer

Djongo Boolean Filed get query is giving key error

i am using MongoDB(3.6) in Django(3.1.5) through djongo(1.3.3). models.py from djongo import models class ModelClass(models.Model): name = models.CharField(max_length=250) is_active = models.BooleanField(default=True) view.py def…
Lokesh sahu
  • 149
  • 1
  • 1
  • 8
2
votes
1 answer

Django with Mongodb not creating id

I am trying Mongodb with Django and for that I am using djongo engine. I have created a simple model with two fields class questions(models.Model): question = models.CharField(max_length=3000) answer = models.CharField(max_length=300000) I…
Nilesh
  • 69
  • 1
  • 11
2
votes
1 answer

MongoDB embedded and array fields in django

I have a question about querying embedded and array fields in django. This is my models.py file: from djongo import models class detalji_igrica(models.Model): pegi_rejting = models.IntegerField() izdavac = models.CharField(max_length=64) …
mr.m.m.
  • 21
  • 5
2
votes
0 answers

djongo ArrayField not appearing in Django Admin

I am following the official docs of Djongo mapper => https://www.djongomapper.com/using-django-with-mongodb-array-field/ to add Array Fields to my Model, but unfortunately even after adding the Array Fields as stated in the docs I am unable to see…
Divyanshu Rawat
  • 4,421
  • 2
  • 37
  • 53
2
votes
1 answer

Empty M2M data if using prefetch_related django

i'm using Django with DRF, and i stucked on a N+1 problem. So, i trying to use prefetch_related now, and i have some problems with it. prefetch_related returns empty queryset in any situation. I'm using: Django 3.0.7 Djongo (Django DB Backend for…
Yshmeel
  • 36
  • 5
2
votes
1 answer

Djongo ArrayField 'Item' is not subscriptable

I have 2 models in my django project. DB is mongoDB and I use Djongo. Here are the models: class Item(models.Model): item_id = models.IntegerField(primary_key=True) item_name = models.CharField(max_length=30) def __str__(self): …
2
votes
0 answers

Why did djongo create a migration on my local server when I specified the host to be on Mlab?

In my settings.py file I have the following: 'ENGINE': 'djongo', 'NAME': ', 'HOST': 'mongodb://username:@ds147436.mlab.com:47436/', 'USER': 'username', 'PASSWORD': '', But when I run 'py…
Simon Suh
  • 10,599
  • 25
  • 86
  • 110
2
votes
0 answers

Unable to create a collection in MongoDb atlas using Django RestApi framework

So basically i created a new Django project and an app which contains my model. I have already created a free cluster on mongoDb atlas and connected my project via Djongo engine. Issues: when i first made make migrations and then migrated my model ,…
yukta
  • 21
  • 1
  • 6
2
votes
1 answer

Django with Djongo, EmbeddedFields returns Models aren't loaded yet

I have a new Django project setup. I have only one package installed Djongo. And i have a local MongoDB running. If I write a simple model with just CharFields in models.py in my app the migration works fine. But when I use EmbeddedFields it returns…
Felix Eklöf
  • 3,253
  • 2
  • 10
  • 27
2
votes
1 answer

Django + Heroku + MongoDB Atlas (Djongo) = DatabaseError with No Exception

One line description of the issue Whenever my django app deployed on heroku tries to access my MongoDB Atlas cluster to submit a form or check an admin login it throws something like the attached error. Extra Details Error reproducible on heroku…
huesca12
  • 138
  • 14
2
votes
0 answers

Using filter for count annotation with Djongo

Currently I'm using Django and a MongoDB configured with Djongo. These are my 2 classes: class Machine (models.Model): machine_type = models.ForeignKey(MachineType, related_name ='machine_types', on_delete = models.CASCADE) machine_customer =…
1 2
3
18 19