MongoDB and Mongoose - Create and Save a Record of a Model: Tests always Time out

Tell us what’s happening:
Describe your issue in detail here.

Your project link(s)

solution: boilerplate-mongomongoose - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/117.0

Challenge: MongoDB and Mongoose - Create and Save a Record of a Model

Link to the challenge:

I get the following error, eventhough I used the code provided in the example solution:

“MongoError: (Unauthorized) not authorized on admin to execute command { insert: “people”, documents: [[{favoriteFoods [eggs fish fresh fruit]} {_id ObjectID(“650b341082d6e1166ab9a4bc”)} {name Jane Fonda} {age 84} {__v 0}]], ordered: true, writeConcern: { w: “majority” }, lsid: { id: {4 [185 110 57 54 98 235 65 254 159 245 240 54 169 4 198 79]} }, txnNumber: 1.000000, $clusterTime: { clusterTime: {1695233037 13}, signature: { hash: {0 [71 7 73 97 21 143 163 219 243 242 197 109 107 42 6 147 45 253 216 251]}, keyId: 7230876136316600320.000000 } }, $db: “admin” }”

Did you name your database admin?

If so change the name in the connection string to something else (below myDatabase is the name).

mongodb+srv://yourName:yourPassword@cluster123.someThingSomeThing.mongodb.net/myDatabase?retryWrites=true&w=majority

If that doesn’t work. Post your connection string, but remove the password from it.

Thank you, changing the name of the database in the connection string worked out :slight_smile:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.