Shard Keys - can't access any data in db. m103

Hi all,

I’m having an issue with following the steps in Shard Keys lecture - my m103 db is seen by mongos but I can’t access it. When I run db.show collections, nothing comes up, and when I try to findOne() document, it returns null.

I must have something to do with the fact that I have struggled before with adding a shard replica set to the cluster in the previous lectures but finally sorted my issue by rebuilding:

csrs replica set,
mongos
replica set, which now is sharded - m103-repl.

After successfully adding m103-repl to my sharded cluster, during the next lecture (the one I’m going through now) i realised that this replica set had a database m103 with a collection products imported from json in earlier stage of the course.

To fix this, I have imported it again to newly rebuild part of my new m103-repl, to my node1 : 27001, which has been completed scusscessfully and I can log on to this node directly and review the database (all documents have been imported correctly).

The problem is however, when I try to do anything using this db on my mongos:Screenshot 2020-01-21 at 19.54.01

Screenshot 2020-01-21 at 19.55.51

Screenshot 2020-01-21 at 19.56.35

I know this is only a lecture and I don’t HAVE TO follow it, but I’d like to and something tells me that the future lab will be connecting to creating a shared key, etc.

Should I be worried that I can’t see this db on my mongos?

Sometimes, all you need to do is work backwards to see exactly what mistakes you may have made:
image

1 Like

Thank you Mr Bond!

You’re not doubleO for nothing ;).
I must have been in front of the monitor for too long yesterday and I didn’t spot this typo…

This has resolved my issue and I have managed to create the shard key now, following the lecture.

THANK YOU VERY MUCH!!!

I’m just wondering is it important to remove that ‘103’ from my sh somehow and if I should, how would I go about it? :thinking:

Good to hear! :male_detective:

I wouldn’t worry about it. There should be an entry/document in one of the collections in the config db.

excellent!

Thank’s again!

Good luck with your further missions! :wink: