WriteConcern constructor sets getlasterror incorrectly for w<1

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Cannot Reproduce
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.1
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Creating a WriteConcern with a w value of 0 or -1 incorrectly sets getlasterror to 1 instead of 0.

      The callGetLastError method correctly returns true only if w > 0.

      It appears that this line in the constructor WriteConcern( int w , int wtimeout , boolean fsync):
      _command = new BasicDBObject( "getlasterror" , 1 );
      should be change to:
      _command = new BasicDBObject( "getlasterror" , _w > 0 ? 1 : 0 );

            Assignee:
            Eliot Horowitz (Inactive)
            Reporter:
            Dan Flye
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: