Chapter 5 aggregation and framework

db.listingsAndReviews.findOne({ },{ “address”: 1, “_id”: 0 })
This command shows the following error in shell
“ok” : 0,
“errmsg” : “cannot do raw queries on admin in atlas”,
“code” : 8000,
“codeName” : “AtlasError”

Use the use DatabaseName command to start using the appropriate database.


You are connected to the admin database here that’s why you got this error. As @steevej-1495 mentioned, connect to the appropriate database and you will get the desired result.

Let us know if you have any other doubts or confusion.

~ Shubham