I am not able to add

The error message you posted shows:

"errmsg" : "(Unauthorized) not authorized on admin to execute command { insert: \"pets\", ordered: true, lsid: { id: {4 [240 184 37 69 164 234 79 180 171 92 104 163 106 217 101 174]} }, $clusterTime: { clusterTime: {1661671493 2}, signature: { hash: {0 [37 55 125 33 194 184 27 154 103 223 56 230 69 119 135 230 97 114 182 242]}, keyId: 7094555532198936576.000000 } }, $db: \"admin\" }"

This means you’re in the admin database and trying to perform an insert(). This matches up with Ramamchandra’s comments:

You will want to change to the database you created for the course which by default is myFirstDatabase if I remember correctly.

1 Like