Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-1367

bsoncxx::types::timestamp t and i parts are reversed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 3.1.1
    • Fix Version/s: 3.2.0-rc0
    • Component/s: BSON
    • Labels:
      None
    • Story Points:
      0.5

      Description

      The "timestamp" and "increment" fields of bsoncxx::types::timestamp are being passed incorrectly to bson_append_timestamp in the core builder. As part of the work of fixing it, we should write a regression test for the bug.

      This fix will need to be backported to at least 3.1.x.

      Previous description:

      Hi!
      Is it normal that parts of timestamp i and t are confused?

      bsoncxx::types::b_timestamp last;
      last.timestamp = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
      last.increment = 0;
       
      bsoncxx::builder::stream::document filter;
      filter << "ts" << bsoncxx::builder::stream::open_document << "$gt" << last << bsoncxx::builder::stream::close_document;
      std::cout << bsoncxx::to_json(filter.view()) << std::endl;
       
      { "ts" : { "$gt" : { "$timestamp" : { "t" : 0, "i" : 1497105104 } } } } 
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: