These are the commands I used. The issue is I can not properly insert any data. No sure if the issue is with user role or the construct of the insert.
Thanks in advance.
use bios
db.createUser({
user: "mongoAdmin",
pwd: "12345678",
roles: ["readWrite", "dbAdmin"]
})
db.bios.insertMany([
{
"_id" : 1,
"name" : {
"first" : "John",
"last" : "Backus"
},
"birth" : ISODate("1924-12-03T05:00:00Z"),
"death" : ISODate("2007-03-17T04:00:00Z"),
"contribs" : [
"Fortran",
"ALGOL",
"Backus-Naur Form",
"FP"
],
"awards" : [
{
"award" : "W.W. McDowell Award",
"year" : 1967,
"by" : "IEEE Computer Society"
},
{
"award" : "National Medal of Science",
"year" : 1975,
"by" : "National Science Foundation"
},
{
"award" : "Turing Award",
"year" : 1977,
"by" : "ACM"
},
{
"award" : "Draper Prize",
"year" : 1993,
"by" : "National Academy of Engineering"
}
]
}
] );
Getting this ERROR
2023-02-17T17:47:37.991-0500 E QUERY [js] uncaught exception: WriteCommandError({
"ok" : 0,
"errmsg" : "not authorized on bios to execute command { insert: \"bios\", ordered: true, lsid: { id: UUID(\"4daafa5f-1b95-460a-8c4b-a303ea05eb50\") }, $db: \"bios\" }",
"code" : 13,
"codeName" : "Unauthorized"
}) :
WriteCommandError({
"ok" : 0,
"errmsg" : "not authorized on bios to execute command { insert: \"bios\", ordered: true, lsid: { id: UUID(\"4daafa5f-1b95-460a-8c4b-a303ea05eb50\") }, $db: \"bios\" }",
"code" : 13,
"codeName" : "Unauthorized"
})
WriteCommandError@src/mongo/shell/bulk_api.js:417:48
executeBatch@src/mongo/shell/bulk_api.js:915:23
Bulk/this.execute@src/mongo/shell/bulk_api.js:1163:21
DBCollection.prototype.insertMany@src/mongo/shell/crud_api.js:326:5
@(shell):1:1