Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: MongoDB and WriteConcern

by andal (Hermit)
on Mar 31, 2017 at 05:47 UTC ( [id://1186585]=note: print w/replies, xml ) Need Help??


in reply to Re: MongoDB and WriteConcern
in thread MongoDB and WriteConcern

Sorry, as usually I forgot that people don't know the context of my question. I do know how to use perl and perl modules. I just was hoping that someone knows how to use specific feature of MongoDB via perl module. I guess this is wrong place to ask such questions. It would be better to contact some mailing list of MongoDB module users.

Anyway, it looks like I've found the answer myself. When connecting to MongoDB one can specify WriteConcern using attributes w, j, and wtimeout. This is described in perldoc MongoDB::MongoClient. So the connecting code would look like

my $cnx = MongoDB::MongoClient->new( host => 'mongodb://myhost1,myhost2', w => 'majority', j => 1, wtimeout => 10000, replicaSet => 'myset');
At least this way after killing primary I don't loose data anymore.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1186585]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-04-19 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found