Package com.mongodb

Class MongoNotPrimaryException

  • All Implemented Interfaces:
    Serializable

    public class MongoNotPrimaryException
    extends MongoCommandException
    An exception indicating that the server is a member of a replica set but is not the primary, and therefore refused to execute either a write operation or a read operation that required a primary. This can happen during a replica set election.
    Since:
    3.0
    See Also:
    Serialized Form
    • Constructor Detail

      • MongoNotPrimaryException

        public MongoNotPrimaryException​(BsonDocument response,
                                        ServerAddress serverAddress)
        Construct an instance.
        Parameters:
        response - the full response from the server
        serverAddress - the address of the server
        Since:
        3.8