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

I did not use the “findOne” in other to have all of them but the room type i get from this does not seem to be correct when i select them as answers.
db.listingsAndReviews.find({},{“room_type”:1, “_id”:0}).
i have as the room types: “Entire home/apt” and “Private room”.
but the system is saying it is incorrect.
Anyone knows why?

Because there is more than

thanks, i found it. entered a precise mql