Cannot no longer query data in movieDetails collection

I am no longer able to query my data in my movieDetails collection via the MongoDB Shell.

I was able to query my movieDetails collection for Chapter 2 and complete all the labs and quizzes.

At the end of Chapter 2 I did import the “reviews” collection and I’m able to query the data in them.

When I started Chapter 3 I noticed that “show dbs” no longer showed my “video” database in the Mongo DB shell. I logged out and back in, still had the same issue. Logged out and back in a third time and now I can see my “video” collection.

My MongoDB Atlas and my MongoDB Compass show my movieDetails collection.

When I issue the command db.movieDetails.find().pretty(), I get results back.

But commands such as db.movieDetails.find({genres: “Family”}) or db.movieDetails.find({runtime: {gt: 90}}) return nothing…

Am I suddenly doing something wrong?

If you are connected to your Sandbox cluster you should be able to query
Make sure you are connected to correct DB
show dbs
use video
show collections

*Update… my mongodb shell appears to be working fine now

Yes, I am connected… see anything I am doing wrong here?

MongoDB Enterprise Cluster0-shard-0:PRIMARY> show dbs
admin 0.000GB
local 4.847GB
video 0.001GB
MongoDB Enterprise Cluster0-shard-0:PRIMARY> use video
switched to db video
MongoDB Enterprise Cluster0-shard-0:PRIMARY> show collections
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.movieDetails.find({genres: “Family”})
MongoDB Enterprise Cluster0-shard-0:PRIMARY>

*** This appears to be working now ***

What is usually trick / and happen to me many time, is that since databases and collection are created automatically it does not throw any error when you try to switch into a db that does not exists - typo included - I got trolled by this a million of times.

Otherwise based on the description you did something little off - like a different instance / start up etc. Restart /lock of should never help and solve issues with visibility of collection / db

Hi @Scott_86953,

I am not sure what was the issue here but I believe you might have been connected to an incorrect database.

This is an incorrect query. You missed the $ sign in front of the gt operator.

The query should be :

db.movieDetails.find({runtime: {$gt: 90}})

This is a little strange. Please connect to your sandbox cluster and run the following queries and share the output.

use video
show collections
db.movieDetails.find({genres: "Family"}).count()

Shubham Ranjan
Curriculum Support Engineer