[CXX-1367] bsoncxx::types::timestamp t and i parts are reversed Created: 10/Jun/17  Updated: 28/Oct/23  Resolved: 16/Jun/17

Status: Closed
Project: C++ Driver
Component/s: BSON
Affects Version/s: 3.1.1
Fix Version/s: 3.2.0-rc0

Type: Bug Priority: Minor - P4
Reporter: Denis Bip Assignee: Samuel Rossi (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
backported by CXX-1371 Backport fix for b_timestamp fields a... Closed
backports CXX-1700 b_timestamp fields inversion Closed

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



 Comments   
Comment by Githook User [ 16/Jun/17 ]

Author:

{u'username': u'saghm', u'name': u'Saghm Rossi', u'email': u'saghmrossi@gmail.com'}

Message: CXX-1367 Pass b_timestamp fields to bson_append_timestamp in correct order
Branch: master
https://github.com/mongodb/mongo-cxx-driver/commit/2c649cc1ee269f0a1f3a957906234a980ad79444

Comment by Samuel Rossi (Inactive) [ 13/Jun/17 ]

Hi! You're correct, this is a bug in our implementation. Thanks for bringing it to our attention! We're working on a fix for it right now.

Generated at Wed Feb 07 22:02:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.