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

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.2.0-rc0
    • Affects Version/s: 3.1.1
    • Component/s: BSON
    • Labels:
      None

      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 } } } } 
      

            Assignee:
            sam.rossi@mongodb.com Samuel Rossi (Inactive)
            Reporter:
            denbip Denis Bip
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: