[CXX-171] C++ driver should support all Write Concern types Created: 23/Apr/12  Updated: 13/Nov/14  Resolved: 29/Apr/14

Status: Closed
Project: C++ Driver
Component/s: Implementation
Affects Version/s: None
Fix Version/s: legacy-0.9.0

Type: Improvement Priority: Critical - P2
Reporter: Jeff Andrews Assignee: Tyler Brock
Resolution: Duplicate Votes: 3
Labels: cxxcopy, legacy-cxx
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

All


Issue Links:
Depends
depends on CXX-182 Add support for Write Concern (outsid... Closed
Related
related to CXX-251 Add MongoClient for C++ Driver Closed

 Description   

Right now, the C++ driver only supports NONE and NORMAL.
What about JOURNAL, FSYNC, REPLICA_SAFE, etc?



 Comments   
Comment by Tyler Brock [ 29/Apr/14 ]

This ticket is effectively subsumed by CXX-182 which will implement WriteConcern.

Comment by Rodolfo Rodriguez [ 14/Jan/13 ]

Hi,

Were using the C++ driver for MongoDB on Windows.
Are there any plans to get support for implementing that // TODO SAFE = 2 soon?

Comment by Jeff Andrews [ 23/Apr/12 ]

Cool, the first method you mentioned is introduced in the 2.1.0 version, right? We're only using "stable" releases right now (mongodb-linux-x86_64-v2.0-latest.tgz). But, I shall remember that when the driver becomes available via download.
Thanks, Eliot!

Comment by Eliot Horowitz (Inactive) [ 23/Apr/12 ]

You need to a getLastError with whatever options you want.

Actually, there is also this method

        string getLastError(bool fsync = false, bool j = false, int w = 0, int wtimeout = 0);

that supports all the options.

so you would do something like

connection.insert( "test.foo" , BSON( "x" << 1 ) );
connection.getLastError( false , true , 2 , 0 );

But yes - leaving this open as we do need to add more helpers for WriteConcern

Comment by Jeff Andrews [ 23/Apr/12 ]

So, I have to issue a raw command to change the write concern?

This is from the latest code...(dbclient.h)

/**

  • controls how much a clients cares about writes
  • default is NORMAL
    */
    enum WriteConcern { W_NONE = 0 , // TODO: not every connection type fully supports this W_NORMAL = 1 // TODO SAFE = 2 }

    ;

If I have to do it manually then fine, but I would still like to see the improvement in the C++ driver.

Comment by Eliot Horowitz (Inactive) [ 23/Apr/12 ]

You can do any of them using a raw getLastError command, what's missing is helpers.

Generated at Wed Feb 07 21:58:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.