Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:26:44+00:00 2026-06-11T00:26:44+00:00

A typical PHP call to mongodb’s replica set $m1 = new Mongo(mongodb://sf2.example.com,ny1.example.com, array(replicaSet =>

  • 0

A typical PHP call to mongodb’s replica set

$m1 = new Mongo("mongodb://sf2.example.com,ny1.example.com", 
      array("replicaSet" => "myReplSet"));

The document said:

// you only need to pass a single seed, the driver will derive the full list and
// find the master from this seed

Questions:

  1. So does it mean the driver will derive the full list on every request? Or they will cache it?

  2. If they cache it, will it cause a problem during fail over? Write to the slave while it is being demoted as secondary

  3. Will the driver refresh the server list and retry the write when it experienced write error?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:26:46+00:00Added an answer on June 11, 2026 at 12:26 am

    To answer your questions:

    1) The PHP driver, like most MongoDB drivers, will cache the connection information once it derives it.

    2) In the event of a fail-over, the former primary node will drop all connections to all clients. The next time the driver attempts to read or write on the socket, it will get an error. If the driver can’t reconnect to the new primary node at the time of the operation, it will throw a PHP MongoConnectionException exception.

    3) It is up to your application to catch this exception and to retry when this exception has been thrown.

    Reference: http://php.net/manual/en/mongo.connecting.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have typical web application based on PHP, HTML, and javascript. From an HTML
Typical problem - I am trying to save new parent object with nested new
in typical PHP applications I used to use mysql_real_escape_string before I did SQL inserts.
I am running a typical php-engined ajax webpage. I use echo to return a
I have a typical mail.php script, which uses the mail() function. After the user
PHP - Apache with Codeigniter JS - typical with jQuery and in house lib
it looks like I'm facing a typical memory outage problem when using a PHP
Typical PHP socket functionality is synchronous, and halts the thread when waiting for incoming
I am new to MongoDB, but am looking at it to solve this problem:
The typical way to use : <?php class A { public $var; public function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.