Single connection to server type: Secondary is not writeable

I’m on lesson 2.4 and when I go to create the moviesScratch collection, I see this message and it won’t let me create the collection. What do I need to fix?

edit: Never-mind, I figured it out.

Never-mind, I fixed it. Thanks!

Hi @Julie_M_Baliga_26397,

I’m glad your issue got resolved. Please feel free to get back to us if you have any other query.

Thanks,
Shubham Ranjan
Curriculum Services Engineer

Would you like to share how did you figure it out? It will help many of learners here.

Thank you.

@Julie_M_Baliga_26397 Why don’t you share the Solution with other ones?

Ok, I also figured it out and described a solution here. Please rate it up on StackOverflow, if it helps you to solve this issue:

Hi @Samuel_79093,

Thanks for sharing.

For any users who might be facing similar issue : :arrow_down:

In the course lecture, we recommend our users to select Read Preference as Primary Preferred because sometimes the Primary may be down for some reason so in that case the client application can still read from the Secondary rather than throwing an error.

If you are directly connected to the Primary node of the replica set then you may end up getting such errors as the Primary node may switch to Secondary as a result of election in the replica set.

So, it’s always recommended to connect to a replica set. You can do so either by using the replica set SRV record or Replica Set Name when filling in your connection information.

Hope it helps!

Thanks,
Shubham Ranjan
Curriculum Support Engineer