Command to view documents

Greetings to all.

I’m trying to use db.movieDetails.find().pretty() command to give me the documents in the collection, but it returns nothing.Please help.

Thanks in advance.Capture

Hey @Arsh_Deep_Singh_26375

Start up a mongo shell again and run all the commands you have expect use movieDetails
When you run that command you are switch from the video db to a new db; which does not have a movieDetails collections

Hi @Arsh_Deep_Singh_26375,

As @natac13 mentioned, you have incorrectly pointed the db variable to refer to the movieDetails database, which does not exist. In the video database we have movieDetails collection. The use command is used to switch between various databases. We do not use this command on colleciton names.

As i can see in the screenshots, you have executed the command :

use movieDetials :x:

That’s why your find query is not returning any documents.

If you want to see the documents present in the movieDetails collection, use the video database.

use video

If you still have any other query, feel free to get back to us. Happy Learning :slight_smile:

Shubham Rajan
Curriculum Support Engineer