@@ -611,9 +611,16 @@ func (s MongoClickhouseSuite) Test_Json_Types() {
611611 {Key : "nan" , Value : math .NaN ()},
612612 {Key : "pos_inf" , Value : math .Inf (1 )},
613613 {Key : "neg_inf" , Value : math .Inf (- 1 )},
614- // Arrays with special floats
614+
615+ // Datetime
616+ {Key : "date_time" , Value : bson .DateTime (1672531200000 )}, // 2023-01-01 00:00:00 UTC
617+ {Key : "date_time_outside_rfc3339" , Value : bson .DateTime (253433923200000 )}, // 10001-01-01 00:00:00 UTC
618+ {Key : "date_time_max" , Value : bson .DateTime (math .MaxInt64 )},
619+ {Key : "date_time_min" , Value : bson .DateTime (math .MinInt64 )},
620+
621+ // Arrays with special values
615622 {Key : "array_mixed" , Value : bson.A {1 , "str" , true }},
616- {Key : "array_special_floats " , Value : bson.A {math .NaN (), math .Inf (1 ), math .Inf (- 1 )}},
623+ {Key : "array_special_values " , Value : bson.A {math .NaN (), math .Inf (1 ), math .Inf (- 1 ), bson . DateTime ( math . MaxInt64 )}},
617624
618625 // Complex nested documents
619626 {Key : "nested_doc" , Value : bson.D {
@@ -630,7 +637,7 @@ func (s MongoClickhouseSuite) Test_Json_Types() {
630637 {Key : "nested_array" , Value : bson.A {
631638 bson.D {{Key : "inner1" , Value : bson.A {
632639 bson.D {{Key : "inner_inner" , Value : bson.A {
633- math .NaN (), math .Inf (1 ), math .Inf (- 1 ),
640+ math .NaN (), math .Inf (1 ), math .Inf (- 1 ), bson . DateTime ( math . MaxInt64 ),
634641 }}},
635642 }}},
636643 bson.D {{Key : "inner2" , Value : 1.23 }},
@@ -651,7 +658,6 @@ func (s MongoClickhouseSuite) Test_Json_Types() {
651658
652659 // Other bson types
653660 {Key : "object_id" , Value : oid },
654- {Key : "date_time" , Value : bson .DateTime (1672531200000 )}, // 2023-01-01 00:00:00 UTC
655661 {Key : "symbol" , Value : bson .Symbol ("test_symbol" )},
656662 {Key : "binary" , Value : bson.Binary {Subtype : 0x02 , Data : []byte ("hello world" )}},
657663 {Key : "binary_empty" , Value : bson.Binary {Subtype : 0x00 , Data : []byte {}}},
@@ -720,16 +726,20 @@ func (s MongoClickhouseSuite) Test_Json_Types() {
720726 require .Contains (t , row , `"nan":"NaN"` )
721727 require .Contains (t , row , `"pos_inf":"+Inf"` )
722728 require .Contains (t , row , `"neg_inf":"-Inf"` )
729+ require .Contains (t , row , `"date_time":"2023-01-01T00:00:00Z"` )
730+ require .Contains (t , row , `"date_time_outside_rfc3339":"10001-01-01T00:00:00Z"` )
731+ require .Contains (t , row , `"date_time_max":"292278994-08-17T07:12:55.807Z"` )
732+ require .Contains (t , row , `"date_time_min":"-292275055-05-16T16:47:04.192Z"` )
723733 // mixed array promoted common type
724734 require .Contains (t , row , `"array_mixed":[1,"str",true]` )
725- require .Contains (t , row , `"array_special_floats ":["NaN","+Inf","-Inf"]` )
735+ require .Contains (t , row , `"array_special_values ":["NaN","+Inf","-Inf","292278994-08-17T07:12:55.807Z "]` )
726736 require .Contains (t , row , `"nested_doc":{"inner1":"str","inner2":1,"inner3":true,"inner4":{"a":"NaN","b":["hello","world"]}}` )
727- require .Contains (t , row , `"nested_array":[{"inner1":[{"inner_inner":["NaN","+Inf","-Inf"]}]},{"inner2":1.23}]` )
737+ require .Contains (t , row ,
738+ `"nested_array":[{"inner1":[{"inner_inner":["NaN","+Inf","-Inf","292278994-08-17T07:12:55.807Z"]}]},{"inner2":1.23}]` )
728739 require .Contains (t , row , `"nested_array_2":[{"NaN":"NaN"},{"binary":{"Data":"dGVzdA==","Subtype":0}},` +
729740 `{"nested_arr":[[1],[2],[3]]},{"nested_doc":{"str":"hello world"}},{"timestamp":{"I":1,"T":1672531200}}]` )
730741
731742 require .Contains (t , row , `"object_id":"507f1f77bcf86cd799439011"` )
732- require .Contains (t , row , `"date_time":"2023-01-01T00:00:00Z"` )
733743 require .Contains (t , row , `"symbol":"test_symbol"` )
734744 // binary data should be base64 encoded
735745 require .Contains (t , row , `"binary":{"Data":"aGVsbG8gd29ybGQ=","Subtype":2}` )
0 commit comments