Search code examples
mongodbprismaprisma-graphql

I cant start a project with Prisma with local Mongodb


Hello I cant start my project with Prisma. When I write prisma init proj it and choose an existing Mongodb server it wants a string but I don't know what should I write and when input the following string it does not work: http://userAdmin:Admin@localhost:27017/admin

This is my mongod user I created in the admin database:

{
    "_id": "admin.userAdmin",
    "userId": UUID("7c5c2b24-7ba6-4252-a06f-3ed6f04b2af5"),
    "user": "userAdmin",
    "db": "admin",
    "roles": [
        {
            "role": "userAdminAnyDatabase",
            "db": "admin"
        },
        {
            "role": "readWriteAnyDatabase",
            "db": "admin"
        }
    ],
    "mechanisms": [
        "SCRAM-SHA-1",
        "SCRAM-SHA-256"
    ]
}

Solution

  • You probably need to fix the URI. The standard mongodb URI connection scheme has the form:

    mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[database][?options]]
    

    (via https://docs.mongodb.com/manual/reference/connection-string/)