Create and Save a Record of a Model

I am working this lesson, but what is wrong my steps:
here is my code
https://replit.com/@spadeX/boilerplate-mongomongoose#myApp.js

Your app is listening on port 3000
/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/cmap/connection.js:299
          callback(new MongoError(document));
                   ^

MongoError: bad auth : authentication failed
    at MessageStream.messageHandler (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/cmap/connection.js:299:20)
    at MessageStream.emit (node:events:513:28)
    at processIncomingData (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/cmap/message_stream.js:144:12)
    at MessageStream._write (/home/runner/boilerplate-mongomongoose/node_modules/mongodb/lib/cmap/message_stream.js:42:5)
    at writeOrBuffer (node:internal/streams/writable:391:12)
    at _write (node:internal/streams/writable:332:10)
    at MessageStream.Writable.write (node:internal/streams/writable:336:10)
    at TLSSocket.ondata (node:internal/streams/readable:754:22)
    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'
}
exit status 1

Please let me know?

Your code is not showing for some reason. Could you repost it please?

Please anyone know whats wrong with my code

I think your code is fine. It looks like a problem with authenticating the database. You have your MongoDB URI stored in your SECRETS tab?

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