Estou recebendo este erro ao tentar executar a requisição get "/livros":
MongoServerError: user is not allowed to do action [find] on [alura-node.livros]
at Connection.onMessage (D:\Carlos\Desenvolvimento\Alura\Node\alura-node\node_modules\mongodb\lib\cmap\connection.js:202:26)
at MessageStream.<anonymous> (D:\Carlos\Desenvolvimento\Alura\Node\alura-node\node_modules\mongodb\lib\cmap\connection.js:61:60)
at MessageStream.emit (node:events:513:28)
at processIncomingData (D:\Carlos\Desenvolvimento\Alura\Node\alura-node\node_modules\mongodb\lib\cmap\message_stream.js:124:16)
at MessageStream._write (D:\Carlos\Desenvolvimento\Alura\Node\alura-node\node_modules\mongodb\lib\cmap\message_stream.js:33:9)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at TLSSocket.ondata (node:internal/streams/readable:766:22)
at TLSSocket.emit (node:events:513:28) {
ok: 0,
code: 8000,
codeName: 'AtlasError',
[Symbol(errorLabels)]: Set(0) {}
}
app.get('/livros', async (req, res) => {
try {
const resp = await livros.find();
res.status(200).json(resp);
} catch(err) {
console.error(err);
res.status(500).json({
error: 'Falha ao buscar os livros.'
});
};
});