Questions tagged [restframeworkmongoengine]

Django-REST-Framework-Mongoengine ports the standard SQL-based Django-REST-Framework to MongoDB. This library allows you to create MongoDB-backed REST API, using Mongoengine ODM that mimics the familiar SQL-based Django ORM, but validation of deeply nested JSONs much easier. It allows you to specify optionally typed schema of your MongoDB documents and automatically generates validation and Browsable API for them.

Django-REST-Framework-Mongoengine ports the standard SQL-based Django-REST-Framework to MongoDB. This library allows you to create MongoDB-backed REST API, using Mongoengine ODM that mimics the familiar SQL-based Django ORM, but makes validation of deeply nested JSONs much easier. It allows you to specify (optionally) typed schema of your MongoDB documents and automatically generates validation and Browsable API for them.

Helpful links:

37 questions
27
votes
7 answers

ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured

I'm trying to make MongoDB and Django get on with each other the way I want them to. That's the error I'm getting when trying to import viewsets from rest_framework_mongoengine. The whole error looks like this: ImproperlyConfigured: Requested…
Albert
  • 2,146
  • 10
  • 32
  • 54
7
votes
2 answers

While using django restframework Multiple database, serializer.is_valid() always go to default database for validation

I am using django restframework and want to handle multiple databases. I am using django function using(alias) and switch_db(alias) for manually switching between database whenever I want to Get, Post or update data. I am facing problem while…
4
votes
2 answers

Invalid embedded document instance provided to an EmbeddedDocumentField

I am currently working on an billing app and require to have orders inside a bill for that I have following two models Bill and orders class Bill(Document): billNo = IntField(unique=True, blank=False) table =…
3
votes
2 answers

_frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140668266856120

I am getting this error when I go for python manage.py runserver error - _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140668266856120 Please help me out. I saw other questions but it says that…
3
votes
2 answers

how to use django rest filtering with mongoengine for list filtering

views.py from __future__ import unicode_literals from rest_framework_mongoengine.viewsets import ModelViewSet as MongoModelViewSet from app.serializers import * from rest_framework_mongoengine.generics import * from rest_framework import…
3
votes
1 answer

Using restframework mongoengine how to create a queires?

models.py from mongoengine import Document, fields class Tool(Document): Fruit = fields.StringField(required=True) District = fields.StringField(required=True) Area = fields.StringField(required=True) Farmer =…
3
votes
0 answers

mongoengine and django rest framework - fields aren't allowed to be optional

I've setup a REST api with django rest framework, using mongoengine as the ORM for my models. However, I keep getting this response back from the api for a field that should be optional: {"ref":["This field may not be null."]} The problem I'm…
2
votes
2 answers

NotUniqueError using django and mongoengine

I am using django and mongoengine. This is the error I am getting time and again when I try to save a newly created instance using .save() method.I was able to create a model instance first time but after that any post request is raising this…
2
votes
0 answers

Get all Embedded Documents within all Documents in a Collection using MongoEngine

I've tried searching the internet for this but can't seem to find anything (sorry if this is in here somewhere). I'm using Mongoengine with Django and have the following model: class Event(EmbeddedDocument): tagged_event =…
2
votes
1 answer

updating multiple database tables in one PUT/PATCH

I'm writing a django-rest-framework backend with rest-framework-mongoengine. So far I have schemas for 2 types - for User and for Device(Box). Sources as follows: models.py: from __future__ import unicode_literals import datetime from mongoengine…
1
vote
0 answers

Getting an AttributeError using RetrieveUpdateDestroyAPIView

I am new to django and am using mongoengine. I am trying to create an employee database using DRF. All of the APIs are working well but whenever I am trying to fetch a single document which has been deleted its giving me an AttributeError at…
1
vote
1 answer

Django rest-framework with mongodb not creating auto field primary key id

I am saving records in MongoDB using Django rest framework. Migration is as below - # Generated by Django 3.0.5 on 2021-01-17 10:39 from django.db import migrations, models class Migration(migrations.Migration): initial = True …
1
vote
0 answers

How to resolve pymongo authentication failure error?

I am trying to fetch data from my mongodb but it fails with: pymongo.errors.OperationFailure: Authentication failed. It is weird because when I am trying to authenticate with same credentials through robo3T (MongoDB GUI) it is able to connect…
1
vote
1 answer

Django rest framework mongoengine update new field with default value

I'm using Django rest framework mongoengine after created few documents, if i want add a new field with default value. Is there any way to do that orelse i need to update with few custom function. Note: I want to fetch the data with filter having a…
1
vote
1 answer

How to post data to Embedded document with Mongoengine REST

I am trying to use Django with mongoengine to make an API. So far I can get the objects and delete them. but when I want to post some data. Lets say student + course it is giving an error: type object 'Course' has no attribute 'objects' Models en…
1
2 3