BlackPOP
BlackPOP

Reputation: 5747

Configure MongoDB write concern timeout?

How to configure write concern on mongoDB client with time.

I am using mongoDB client with replica acknowledged.I want to configure write concern with wtimeout.I am using Java driver.

mongoClient.setWriteConcern(WriteConcern.REPLICA_ACKNOWLEDGED.continueOnError(true));

How to configure it with wtimeout??

Upvotes: 0

Views: 1946

Answers (1)

Ajay
Ajay

Reputation: 116

From the API (Link)it seems that you can use following constructor to initialize WriteConcern and use the same instead of WriteConcern.REPLICA_ACKNOWLEDGED.continueOnError(true)

mongoClient.setWriteConcern(new WriteConcern(0, 10));

Upvotes: 3

Related Questions