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
1
vote
2 answers

djongo Company with ID “None” doesn’t exist. Perhaps it was deleted?

I couldn't find a solution among similar questions. Using mongosh, the Company objects do exist, but in the admin, they show as object(None) and therefore cannot be edited due to error "Company with ID “None” doesn’t exist. Perhaps it was…
vadtam
  • 343
  • 4
  • 15
1
vote
0 answers

how can I create json data structure in mongodb like this?

I am having a problem to create this structure inside my mongodb. I'm using django. Djongo is the model i used to try and create this but I cant seem to find a way. I've tried using Arrayfield and embeddedfield as well but I'm stuck.
kedink
  • 19
  • 3
1
vote
1 answer

id null on django API with mongo and djongo

I need help. My API get me "id": null instead of the uuid given in mongoDB. Here's the results : And Here's my code : serializers.py from rest_framework import serializers from testapp.models import Test class…
1
vote
1 answer

Receiving "Select a valid choice. That choice is not one of the available choices." while using Djongo ForeignKey with Django

I got this weird error in Django Admin while using the ForeignKey from djongo.models. Not sure if I did anything wrong in the models file. Error Message Image Machine/models.py from djongo import models class Machine(models.Model): _id =…
LatoWolf
  • 9
  • 1
1
vote
1 answer

How to serve image files from MongoDB in Django

I am building a Django application that stores image files in a mongodb GridFS. I use Djongo to work with the database and followed this example https://www.djongomapper.com/using-django-with-mongodb-gridfs/ to store the images to the DB. now I can,…
Fahad Alduraibi
  • 372
  • 6
  • 17
1
vote
0 answers

manage.py migrate not working properly it is migrating exisiting table

I am working in djongo and i created a new model and apply the migrations. My newly created model is: class NetworkIgnoreUsers(models.Model): _id = M.ObjectIdField() userId = models.CharField(max_length=50,blank=True,null=True) …
NoobCoder
  • 625
  • 1
  • 5
  • 18
1
vote
1 answer

Error in Django migrations, no changes detected

I've correctly done the "initial setup" with python manage.py migrate command and now in my mongodb database I see these…
manuersuper
  • 83
  • 2
  • 9
1
vote
1 answer

Django - Unable to test with two databases (postgres with gis extension and mongoDB (Djongo)

I'm not able to test two databases using Django's unittests. My databases configuration: DATABASES = { 'default': {}, 'postgres': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': "", 'USER': "", 'PASSWORD':…
Unknown123
  • 208
  • 2
  • 13
1
vote
0 answers

Using Djongo's ArrayField at Django Admin

Djongo is a Django and MongoDB database connector witch brings, beside others, the ArrayField to Django Models. It allows one to store multiple instances of an other djongo.models.Model in an unique MongoDB Array field inside a document related with…
artu-hnrq
  • 1,343
  • 1
  • 8
  • 30
1
vote
1 answer

django connect to mysql and mongodb

I have 2 databases mysql and mongo. On mysql people hold all data and on mongo just images. I have defined them like this DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': '*****', 'USER': '*****', …
kakakakakakakk
  • 467
  • 10
  • 31
1
vote
1 answer

Django Query to get count of all distinct values for column of mongodb ArrayField

What is the best way to count all distinct values in mongodb ArrayField? Here is my model: class tweet(models.Model): topic = models.JSONField() 3 sample documents: 1. ["investment", "economy"] 2. ["investment"] 3. ["economy",…
Amir Ayat
  • 41
  • 1
  • 5
1
vote
1 answer

Select a valid choice while selecting Foreignkey in django admin mongodb

database in MongoDB (djongo) I have registered a model in admin.py admin.site.register(Media) models.py class Media(BaseModel): _id = models.ObjectIdField(primary_key=True) url = models.URLField() media_type =…
1
vote
1 answer

type object 'multichoice' has no attribute '_default_manager'

I'm using Django with mongoengine. The Admin Panel unable to add data in multichoice model I got this error. type object 'multichoice' has no attribute '_default_manager' Python Version: 3.9.2 Django Version: 3, 0, 5, 'final', 0Model from…
Aly
  • 321
  • 1
  • 4
  • 15
1
vote
0 answers

Djongo ArrayField in Django Admin Panel Error

Whenever I try to go to the product details page I encounter this error - 'list' object has no attribute '_meta' How to solve it? My models class Category(models.Model): name = models.CharField(max_length=200, db_index=True) slug =…
ahmedshahriar
  • 1,053
  • 7
  • 25
1
vote
1 answer

Django override QuerySet for pk

I'm using djongo in order to connect my Django Rest Framework project to MongoDB, As MongoDB using _id as its primary key, I changed my models like this: from djongo import models class MyModel(models.Model): _id =…