Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

359
Views
Error connecting MongoDB with Symfony 5.2

I am trying create a database using MongoDB in my Symfony 5.2

When I add in my .env this

###> doctrine/mongodb-odm-bundle ###
MONGODB_URL=mongodb://localhost:27017
MONGODB_DB=symfony
###< doctrine/mongodb-odm-bundle ###

with the DATABASE_URL var by default (if I change postgresql to mongodb, it says driver not found)

DATABASE_URL="postgresql://db_user:db_password@127.0.0.1:5432/db_name?serverVersion=13&charset=utf8"

I have this error

Connection does not contain a 'path' or 'dbname' parameter and cannot be created.

If I comment the var DATABASE_URL. I got

Environment variable not found: "DATABASE_URL"

My doctrine_mongodb.yaml:

#config/packages/doctrine_mongodb.yaml

doctrine_mongodb:
    auto_generate_proxy_classes: true
    auto_generate_hydrator_classes: true
    connections:
        default:
            server: '%env(resolve:MONGODB_URL)%'
            options: {}
    default_database: '%env(resolve:MONGODB_DB)%'

I am executing this command php bin/console doctrine:database:create

I didn't see many solutions for this trouble here

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!