Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

655
Visualizações
The meaning of ?retryWrites=true&w=majority when you connect Node.js app to Cluster on MongoDB Atlas

When we connect a Node.js application to a cluster on the mongoDB Atlas, we need to add the following URI instead of adding "mongodb://localhost:27017/<dbname>" as you can see at the step 2 in the image.

"mongodb+srv://<username>:<password>@cluster1.tv7cp.mongodb.net/<dbname>?retryWrites=true&w=majority"

Now, what exactly the meaning of ?retryWrites=true&w=majority in it after <dbname>? Why do we need to add it?

I tried and ran the app with mongoose without ?retryWrites=true&w=majority, and it worked fine.

enter image description here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Retryable writes allow MongoDB drivers to automatically retry certain write operations a single time if they encounter network errors, or if they cannot find a healthy primary in the replica sets or sharded cluster.

Write concern describes the level of acknowledgment requested from MongoDB for write operations to a standalone mongod or to replica sets or to sharded clusters. In sharded clusters, mongos instances will pass the write concern on to the shards. ( if your replica set has 3 members that mean that your majority=2 , meaning that your write operation will receive acknowledgment after it receive success confirmation from at least 2 members)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda