Connect to a MongoDB in Django Using Djongo

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 89

  • @prettyprinted
    @prettyprinted  4 роки тому +4

    Join my free course on working with the database and models in Django: prettyprinted.com/djangodata

    • @okeyshourovroy2769
      @okeyshourovroy2769 3 роки тому

      Firebase with django, can you please make a video on it?

  • @mohaamiin8767
    @mohaamiin8767 5 років тому +4

    Bro tnks alot I was waiting for this tutorial since I started ur course Django 2.1

  • @JoseGarcia-lw8gf
    @JoseGarcia-lw8gf 5 років тому +1

    Thanks, I'm new to Django and Mongo. I had to do additional configuration to create a database user, but it was easy ! Now I'll check how to do some basic quries.

    • @prettyprinted
      @prettyprinted  5 років тому

      I'm glad the video helped. Thanks for watching.

    • @tripathi5174
      @tripathi5174 4 роки тому

      is it easy to use mongodb as a databse in django or its different from all the rest of the databases like sqllite and postgre provided by django

  • @fromdjangoimport__help__3585
    @fromdjangoimport__help__3585 3 роки тому +1

    that's something good but is it right thing to do in production??

  • @prasangsinghal262
    @prasangsinghal262 4 роки тому

    Can u plz tell me which version of djongo you are using ?? I am getting some warnings for the lastest version of djongo.
    Following are the warnings I am getting:
    This version of djongo does not support "COLUMN DROP NOT NULL " fully.
    This version of djongo does not support "DROP CASCADE" fully.
    This version of djongo does not support "schema validation using KEY" fully.
    This version of djongo does not support "schema validation using REFERENCES" fully.

  • @bhavinasodariya4527
    @bhavinasodariya4527 2 роки тому

    my database CosmoDB is host on Azure and I need to connect it to the djongo but can`t. so please help me

  • @keshavdk3080
    @keshavdk3080 2 роки тому

    I have integrated Django with Mongo db using djongo connector. Now If i create a user named "john" from superuser login and add some tasks to john(which is related to our project) .
    I log out from superuser and login login as user john, then the tasks assigned from super user login will not be visible here and says could not fetch tasks, and in VS code ,it throws backend error as Sub SQL: None
    FAILED SQL: SELECT COUNT(*) FROM (SELECT DISTINCT....)
    Params: (6, 6, 6, 6, 6, 6)
    Version: 1.3.4
    Any idea please.

  • @deekshithpodila3928
    @deekshithpodila3928 4 роки тому +1

    Hi @prettyprinted .I am using mongodb atlas with free cluster, so before connecting to the mongo atlas db, i connected to local mongo db and ran migrations which was sucessfull.I coould see all the collections created by djongo, but when i treid to connect to atlas using the connection string provided and ran migrations i got "No migrations to apply" and i could not see any collections at all.
    Can you tell me where am i doing mistake.
    Thanks .

  • @EyakubSorkarF
    @EyakubSorkarF 4 роки тому +5

    django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available database backend.
    what to do about this?

    • @niharikas2073
      @niharikas2073 4 роки тому

      Did you got solution to this error? Because I also got same

    • @OurCodeSchool
      @OurCodeSchool 4 роки тому

      @@niharikas2073 yeah so far I've solved that issue om that day and it's almost 2 months. I really can't remember the issue anymore. Also forgot to write down the solution. I'm sorry about it. That was for someone else so don't have the project either right now.

    • @niharikas2073
      @niharikas2073 4 роки тому

      @@OurCodeSchool Ok.. No problem

    • @anantkumar235
      @anantkumar235 4 роки тому

      always look for dependencies first,,
      >>>>djongo does not support django3*

    • @niharikas2073
      @niharikas2073 4 роки тому

      @@anantkumar235 I'm using django 2.2

  • @tomasloureirogomes4628
    @tomasloureirogomes4628 4 роки тому +1

    Awesome video! I have one question... Can i use Django ORM (QuerySets) with Djongo? Thanks!

    • @arunim2000
      @arunim2000 4 роки тому +3

      Djongo defines itself as The only connector that let's you use Django with MongoDB without changing the Django ORM
      So i think that Django ORM should work with djongo

  • @Childishforlife
    @Childishforlife 4 роки тому +1

    django.core.exceptions.ImproperlyConfigured: 'djongo' isn't an available database backend.
    Any ideas?

    • @pushkargarg7140
      @pushkargarg7140 4 роки тому +1

      django version?

    • @Childishforlife
      @Childishforlife 4 роки тому

      @@pushkargarg7140 Yeah that was the issue, doesn't work for Django 3.0.

    • @pushkargarg7140
      @pushkargarg7140 4 роки тому

      @@Childishforlife yes I'm facing the same issue with Django 3 so I rolled back to Django 2.2

  • @jagl257
    @jagl257 4 роки тому +1

    Hi can you create a new tutorial using djongo and creating and migrating models

  • @chinmaydali3083
    @chinmaydali3083 4 роки тому +1

    Hey thanks for the tutorial, one question though --> Does "djongo" let me use SQL queries by that I mean the queryset we write in django to fetch data even when MongoDB is a NoSQL DB

    • @iambhushan418
      @iambhushan418 3 роки тому

      hey bro did you got its answer??

    • @iambhushan418
      @iambhushan418 3 роки тому

      I have to use drf to make api with mongodb does it works the same?

    • @chinmaydali3083
      @chinmaydali3083 3 роки тому

      @@iambhushan418 django comes with python orm for SQL ie sql-alchemy similarly their is pymongo for document DB like mongoDB.

    • @iambhushan418
      @iambhushan418 3 роки тому

      @@chinmaydali3083 yeah

  • @luizeduardomacedodasilva7838
    @luizeduardomacedodasilva7838 4 роки тому +1

    help pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed.
    I'm deploying to heroku. I put my Mongo_URI in the environment variable but I can't connect to the bank.
    need HELP

    • @vishnukrishnathu4918
      @vishnukrishnathu4918 3 роки тому

      You need to register your system Ip address to solve this error

  • @codeclockyt
    @codeclockyt 5 років тому

    Thank you so much;
    Can you please do a video on how to dynamically create subdomains in django. Really appreciate.

    • @prettyprinted
      @prettyprinted  5 років тому +1

      I'll look into it. Thanks for the idea.

  • @axelhernandez1903
    @axelhernandez1903 3 роки тому

    I have a mongo db on a docker container, i want to connect my django app to that but idk how, someone can help me?

  • @NicolasMartinez-zu7iu
    @NicolasMartinez-zu7iu 4 роки тому

    can i connect djongo with a db in mongo wit data preexisting???

  • @Gsiniguez
    @Gsiniguez 5 років тому

    Hi how u do a request for put with ObjectId as pk?

  • @dhakshintechi9896
    @dhakshintechi9896 5 років тому

    Nice sir.....pls make some videos about mangoDB

  • @shishir181991
    @shishir181991 5 років тому +1

    how to use pre-existing mongo collection with djongo?

    • @prettyprinted
      @prettyprinted  5 років тому

      Maybe this will help: github.com/nesdis/djongo/issues/38

  • @tripathi5174
    @tripathi5174 4 роки тому

    sir please create a website by using mongodb and django together with some crud some operations and of possible an ecommerce one please sir.

  • @thampasaurusrex3716
    @thampasaurusrex3716 5 років тому

    ty man u helped me a lot

    • @prettyprinted
      @prettyprinted  5 років тому

      You're welcome. Thanks for watching.

  • @anky137339
    @anky137339 5 років тому

    Can we have Mongo dynamic aggregations in basis of user input ?

    • @prettyprinted
      @prettyprinted  5 років тому

      I'm not exactly sure what you mean, but of course you can combine what you request the database to do with user input.

  •  5 років тому

    Hey, have you thought of doing a video on making GraphQL APIs with graphene-python? Seems like many APIs are using GraphQL now instead of REST so I think it would be cool to see how to create GraphQL APIs with python :)

    • @prettyprinted
      @prettyprinted  5 років тому

      I've been meaning to do that actually. I'll start planning out of a GraphQL video. Thanks for reminding me.

  • @kathanpatel3677
    @kathanpatel3677 5 років тому

    Can you please do a video on how to connect aws dynamodb in djnago ?.Really appreciate.

  • @MrJuliolix
    @MrJuliolix 5 років тому

    Thanks Guy!

  • @adnankhan3974
    @adnankhan3974 3 роки тому

    great

  • @harshitrastogi5975
    @harshitrastogi5975 5 років тому

    ERROR - " pymongo.errors.OperationFailure: unsupported type in filter " ......please Help

    • @nishchintgauniyal8505
      @nishchintgauniyal8505 5 років тому

      i m getting the same error

    • @vrukshanikam6743
      @vrukshanikam6743 5 років тому

      Try using a lower version of pymongo, ==3.5.1and choose Python 3.4 in Atlas for a non-srv string, then edit settings for HOST to be
      'mongodb://:@cluster0-shard-00-00-bs91f.mongodb.net:27017,cluster0-shard-00-01-bs91f.mongodb.net:27017,cluster0-shard-00-02-bs91f.mongodb.net:27017/test?ssl=true&ssl_cert_reqs=CERT_NONE&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority'

  • @minhluanpham7805
    @minhluanpham7805 5 років тому

    help pymongo.errors.ServerSelectionTimeoutError: connection closed,connection closed,connection closed

    • @prettyprinted
      @prettyprinted  5 років тому

      Where do you have your MongoDB?

    • @minhluanpham7805
      @minhluanpham7805 5 років тому

      @@prettyprinted python Django , limited English 😥

  • @powerToYourself36
    @powerToYourself36 5 років тому

    I’m getting a certificate error :/

  • @powerToYourself36
    @powerToYourself36 5 років тому

    if anyone here is experiencing problems migrating with the certification error.
    do
    pip install certifi
    pip install dnspython
    goto network access -> add ip address -> dont put anything in -> confirm
    goto your cluster-> click connect->connect your application -> go to python-> copy paste uri
    do the whole username and password
    however here's the important . step
    copy paste this after test?
    ssl=true&ssl_cert_reqs=CERT_NONE&retryWrites=false&w=majority
    mongodb+srv://{username}:{password}@{whatever your cluster is called in uri}/test?ssl=true&ssl_cert_reqs=CERT_NONE&retryWrites=false&w=majority
    should work gl

  • @AnnoyingErrors41
    @AnnoyingErrors41 4 роки тому

    This does not work for Django 3.0

  • @BolivianRetardsUnite
    @BolivianRetardsUnite 4 роки тому +1

    Can anyone help with this error?
    pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [Errno 61] Connection refused
    when trying to run either: or Any Ideas???
    EDIT: found the SOLUTION: stackoverflow.com/questions/60871873/djongo-not-connecting-to-mlab-server
    Also if anyone is stuck on the 'djongo isn't available database': this worked for me:
    --use PyMongo 3.7.2
    #pip uninstall pymongo
    #pip install pymongo==3.7.2

  • @robx1971
    @robx1971 5 років тому

    Would you use MongoDB for production if not, why use MongoDB?

    • @prettyprinted
      @prettyprinted  5 років тому

      I don't like it has a database, but other people do, so I cover it here to help them.

    • @anonymousrulz
      @anonymousrulz 5 років тому

      @@prettyprinted Sorry, I don't understand. Do you mean you are not gonna use MongoDB for production? If not may I ask why?

    • @prettyprinted
      @prettyprinted  5 років тому +1

      @@anonymousrulz I just prefer relational databases. I have more experience with them, and I don't think Mongo offers any advantages for me.

  • @hoolegaensevideobunker6129
    @hoolegaensevideobunker6129 4 роки тому

    On Mac I have a SSL certificate problem. This helps: stackoverflow.com/questions/52805115/certificate-verify-failed-unable-to-get-local-issuer-certificate

  • @parihu
    @parihu 5 років тому

    Hi!
    I liked you video very much but I am getting connection error all the time. I have MongoDB Atlas (of course, sandbox, free version Cluster) and I got the link to connect to it: mongodb+srv://username:@cluster-b1gml.mongodb.net/test?retryWrites=true&w=majority
    but the thing is when I run python3 manage.py migrate. It doesn't work at all!! In here the db name is test right?
    DATABASES = {
    'default': {
    'ENGINE': 'djongo',
    'NAME': 'test',
    'HOST' : 'mongodb+srv://:@cluster-b1gml.mongodb.net/test?retryWrites=true&w=majority',
    'USER' : ',
    'PASSWORD' : ''
    ,
    }
    }
    Please note that and are not revealed, in my PC they are. What am I doing wrong?
    Thanks.

    • @prettyprinted
      @prettyprinted  5 років тому

      What error do you get?

    • @vrukshanikam6743
      @vrukshanikam6743 5 років тому

      I don't know the exact error but try try using pymongo==3.5.1instead of a higher version. If it claims uri+srv as invalid uri, try installing dnspython if that doesnt work change the connection string settings to a lower version of python, 3.4 should give a non-srv string. If it is not able to verify the certificate use this as the host instead
      : 'mongodb://:@cluster0-shard-00-00-bs91f.mongodb.net:27017,cluster0-shard-00-01-bs91f.mongodb.net:27017,cluster0-shard-00-02-bs91f.mongodb.net:27017/test?ssl=true&ssl_cert_reqs=CERT_NONE&replicaSet=Cluster0-shard-0&authSource=admin&retryWrites=true&w=majority'