Query succeeds then same query fails, and other weird stuff

My sandbox is giving me weird behavior. Is it a shared sandbox, where other people might change it while I’m using it? Or am I connecting to the wrong place?
My connection string is
mongo “mongodb+srv://sandbox-qt1dz.mongodb.net/test” --username m001-student --password m001-student-basics
(In Atlas it’s different of course, but same server/user/pw)

For example
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.movieDetails.find({“rated”: “PG”, “awards.nominations”: 10}).count()

a few minutes later:
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.movieDetails.find({“rated”: “PG”, “awards.nominations”: 10}).count()

I tried exiting restarting Shell but that made no difference.

Also, in Atlas {“genres”: “Family”} returns ‘1-20 of many’
but the same query in Shell finds nothing
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.movieDetails.find({“genres”: “Family”})
MongoDB Enterprise Sandbox-shard-0:PRIMARY>

Similarly, Atlas and Shell are different for
MongoDB Enterprise Sandbox-shard-0:PRIMARY> db.movieDetails.find({“writers”: “Ethan Coen”,“writers”: “Joel Coen”}).count()
while Atlas finds three documents

I’m stuck with the 2.3 quiz because right now nothing’s working :frowning:

Your connect string is fine
Don’t see any issues with query results

1 Like

Really, you don’t? Why does an identical query used twice return a different result each time, surely that’s anomalous/weird/wrong?

Thanks for verifying the connect string.

Perhaps you switch database during the few minutes between your 2 first find commands.

As for your find({“genres”: “Family”}) you did not issued the appropriate use database-name before the find. I suspect the same thing with the find with writers.

1 Like

Hi @Alan_Sinclair_29223,

This is not a shared cluster. It is owned by you. The connection string that you have shared above can be used to access your cluster by anyone. So, I will recommend you to change it.

You are seeing the difference in behaviour because most likely you are connected to a different database. You can check it by running the db command.

All the queries that you have shared above is working fine after I connect to your sandbox cluster using the connection string that you have provided.

I would like to point out that everyone in this thread is trying to help you here, so please be courteous toward other members in the forum. We deeply value positivity in our forum :slight_smile:

Shubham Ranjan
Curriculum Services Engineer

thanks, correction appreciated! I should have phrased that better.
I was astonished that a repeated query was returning different results, and hoped for an explanation. I’ll check your kind suggestions and report back.

1 Like

thank you steevej-1495 and Shubham_Ranjan you kindly identified my problem, not using ‘use video’. Using the db command as suggested showed my mistake, and now I can work on the quiz

How do I change the password?

I do have more questions because, using the same connection details, trying to connect with Compass to the same cluster fails (it times out). Is it better to continue this thread or to start another?

thanks again

HI @Alan_Sinclair_29223,

  1. Login to your atlas account
  2. Click Database Access -> Edit

  1. A pop-up will appear. Click Edit Password.

  1. Enter the new password and click Update User.

If it’s related to Compass then please create another thread.

Hope it helps!

Shubham Ranjan
Curriculum Services Engineer

thanks so much Shubham!
Problem solved, though one thing confused me a bit: when I went to change my password in Atlas there was already a password in the field. Initially shown as dots, it displayed as text when I clicked ‘show’ - and it was different than the pw which actually worked to log in.
After a while I realized it was showing Atlas’s own pw, not the cluster pw, but when I put a new pw in the field it was applied to the cluster.
Thanks to your help my cluster now has a new password and all seems well
Many thanks again