Objects getting auto-saved in 'test' database instead of 'user' database

Hi everyone, Im a newbie with exploring mongodb
Im getting a trouble that when i have a database call user, i tested POST action success in postman and no error with that, but when i go to database in mongodb, i saw that the object i posted was in a “test” database (I didnt create it), i tried to delete it and POST object again but it still auto create “test” database and store all object in it, instead of my main database ( still exist) .
In that struggle, i believe that is the reason why i cant connect my DB to my frontend surface
Pls help me

Hey :wave: @Thai_Ph_m_Qu_c,

Welcome to the MongoDB Community forums :sparkles:

From your description, it seems like the objects you are posting are getting stored in the “test” database instead of the “user” database that you intended. This could be due to a misconfiguration or a default setting in your MongoDB setup.

To resolve this issue, I recommend checking your MongoDB connection string and ensuring that it specifies the correct database name (“user” in your case). Additionally, double-check your code to ensure that you are specifying the correct database name when performing database operations.

If you’re still experiencing difficulties after verifying the above, it would be helpful to provide more details about your MongoDB configuration and code snippets. This will allow us to assist you better.

Looking forward to hearing back from you and assisting you further.

Best regards,

1 Like

Hey @Thai_Ph_m_Qu_c ,

In the MongoDB URI string, you need to add the name of the database you need the collections to be added into.

For example,