---
title: How to Query MongoDB Secondary Replica Set Members
slug: user-guide-10x/how-to-query-mongodb-secondary-replica-set-members
docTags: 
createdAt: 2025-12-15T07:42:07.150Z
---

In this article, we learn how to query a MongoDB from a non-master (slave or secondary) replica set member.

Applies to:

- MongoDB replica set

## Problem

When issuing a simple query on a non-master member, the user will see the following error:

:::BlockQuote
Error: error: \{ "$err" : "not master and slaveOk=false", "code" : 13435 }
:::

## What Causes This Error

This is because, by default, MongoDB does not permit *read* operations from a non-master member. In MongoDB, *reads* to a primary provides data that reflects the latest *writes* at all times. However, secondaries are not required to reflect the latest *writes* at all times and changes to the system can propagate gradually.

## How to Fix the Error

By running ***rs.slaveOk()***, you are indicating to the system that you acknowledge that *reads* will eventually be consistent and you wish to be able to query the secondary anyway.

You learned the steps to "Query MongoDB Secondary Replica Set Members".
