Not authorized on [collection] to execute command

I recently installed mongodb and mongoose, created a simple rest-api nodejs app to try it and it was working fine, when I started the server for the first time it created the db with its name passed along with mongoose.connect(), it alse created the empty collection using the Schema which I defined, it also created documents when I passed values into my post route…

now when I am using mongosh, and running cmd “show dbs”, it shows no dbs (even admin and other 2 default dbs are gone)

when I am starting the server, it is not creating the db as it used to do earlier, I surfed the internet and found that sometimes a document has to be created to create the entire db

so I used my app’s post route to pass some values which shall create a document and I am shown this error :
“MongoServerError: not authorized on user-db-app to execute command { insert: “users”, documents: [ { firstName: “Harry”, lastName: “Potter”, email: “”, jobTitle: “Wizard”, _id: ObjectId(‘661619228e06e591de3618a4’), createdAt: new Date(1712724258732), updatedAt: new Date(1712724258732), __v: 0 } ], ordered: true, lsid: { id: UUID(“bfa30139-08a2-4e27-a165-bddb1e47c890”) }, $db: “user-db-app” }”