Skip to Main Content

MongoByte MongoDB Logo

Welcome to the new MongoDB Feedback Portal!

{Improvement: "Your idea"}
We’ve upgraded our system to better capture and act on your feedback.
Your feedback is meaningful and helps us build better products.

Status Under Consideration
Created by Ping Kin Ma
Created on Oct 22, 2025

Add Nearest secondary read preference

What problem are you trying to solve?

Focus on the what and why of the need you have, not the how you'd like it solved.

We would like to avoid the nearest read reference to connect to the primary.

What would you like to see happen?

Describe the desired outcome or enhancement.

Add new read preference "NearestSecondary" OR
new "secondary only" option under existing "nearest" read preference

Why is this important to you or your team?

Explain how the request adds value or solves a business need.

There is no options to utilize secondary & nearest read preference together

What steps, if any, are you taking today to manage this problem?

Use secondary read preference instead of nearest


  • Admin
    Alex Bevilacqua
    Nov 7, 2025

    @Guest, based on the Server Selection specification, you can likely achieve what you're looking to do with just a read preference of secondary with a maxStalenessSeconds value specified:

    If mode is 'secondary' or 'nearest':

    Select all secondaries if mode is 'secondary', or all secondaries and the primary if mode is 'nearest'.From these, filter out servers staler than maxStalenessSeconds if it is a positive number.From the remaining servers, select servers matching the tag_sets.From these, select one server within the latency window.

    It might be worth testing this out to see if it satisfies your particular needs.