Hello, I’m new to MongoDB and have encountered an error trying to shard a collection. Here’s the setup I have:
Project: ‘weather’
Database: ‘weather’
Collections within ‘weather’: ‘users’ and ‘weatherData’
Objective: Create 2 partitions of ‘weatherData’ using a partition key
My access setup in Atlas for user appemail002:
Database access for database ‘weather’: * atlasAdmin[@]admin
dbAdmin[@]weather
dbAdminAnyDatabase[@]admin
enableSharding[@]admin
readWrite[@]weather.weatherData
readWriteAnyDatabase[@]admin
Resources: All Resources
Project access for project ‘weather’:
Project Owner, Project Cluster Manager, Project Data Access Admin, Project Data Access Read Write
Organization access: Organization Owner
Problem: When I connect to the database and try to shard the collection ‘weatherData’, I get this error (I’m using Terminal on Mac):
Thanks @Kobe_W - how do I do that? I used the connection string provided in Atlas but it seems to connect me to the shard straight away… This is the first time I’m using Mongodb for for study. Thanks again!
If it helps at all, here’s what my Metrics page looks like for db ‘weather’ - there seems 2 be 1 Primary Shard and 2 Secondary Shards - I did not create any of these… What I am after is:
Partition collection ‘weatherData’ (which lives in db ‘weather’) into 2 shards/partitions
Hi @D_M2,
Let’s do this, to create a temporary solution, we can create a root user in the admin db.
So in the connection string you will have to put:
mongodb+srv://weather.xdeoqms.mongodb.net/admin
And log in with the new user name.