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

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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36

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

Link to the challenge:

:balloon: Hi, welcome to the forum!
We see you have posted some code but did you have a question?

it s giving error MongoError: (Unauthorized) not authorized on admin to execute command { insert: “people”, documents: [[{favoriteFoods [chicken water]} {_id ObjectID(“63b7ad44eacca30503de37d5”)} {name Sample Person} {age 54} {__v 0}]], ordered: true, writeConcern: { w: “majority” }, lsid: { id: {4 [51 175 164 94 217 90 69 62 174 59 27 60 11 21 42 68]} }, txnNumber: 1.000000, $clusterTime: { clusterTime: {1672981818 17}, signature: { hash: {0 [2 237 64 152 205 12 11 95 16 46 135 55 150 149 44 138 125 75 127 114]}, keyId: 7120629522738708480.000000 } }, $db: “admin” }
at Connection. (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/core/connection/pool.js:453:61)
at Connection.emit (node:events:513:28)
at processMessage (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/core/connection/connection.js:456:10)
at TLSSocket. (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/core/connection/connection.js:625:15)
at TLSSocket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
ok: 0,
code: 8000,
codeName: ‘AtlasError’
}

Creating and saving a db item should succeed (Test timed out)

Try reading here:

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