File tree Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Expand file tree Collapse file tree 3 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -1989,9 +1989,11 @@ _mongoc_topology_description_check_compatible (
1989
1989
MONGOC_ERROR_PROTOCOL ,
1990
1990
MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION ,
1991
1991
"Server at %s reports wire version %d, but this"
1992
- " version of libmongoc requires at least 3 (MongoDB 3.0 )" ,
1992
+ " version of libmongoc requires at least %d (MongoDB %s )" ,
1993
1993
sd -> host .host_and_port ,
1994
- sd -> max_wire_version );
1994
+ sd -> max_wire_version ,
1995
+ WIRE_VERSION_MIN ,
1996
+ _mongoc_wire_version_to_server_version (WIRE_VERSION_MIN ));
1995
1997
}
1996
1998
}
1997
1999
}
Original file line number Diff line number Diff line change @@ -100,6 +100,9 @@ _mongoc_bson_init_if_set (bson_t *bson);
100
100
const char *
101
101
_mongoc_bson_type_to_str (bson_type_t t );
102
102
103
+ const char *
104
+ _mongoc_wire_version_to_server_version (int32_t version );
105
+
103
106
bool
104
107
_mongoc_get_server_id_from_opts (const bson_t * opts ,
105
108
mongoc_error_domain_t domain ,
Original file line number Diff line number Diff line change @@ -268,6 +268,48 @@ _mongoc_bson_type_to_str (bson_type_t t)
268
268
}
269
269
270
270
271
+ /* Refer to:
272
+ * https://github.com/mongodb/specifications/blob/master/source/wireversion-featurelist.rst
273
+ * and:
274
+ * https://github.com/mongodb/mongo/blob/master/src/mongo/db/wire_version.h#L57
275
+ */
276
+ const char *
277
+ _mongoc_wire_version_to_server_version (int32_t version )
278
+ {
279
+ switch (version ) {
280
+ case 1 :
281
+ case 2 :
282
+ return "2.6" ;
283
+ case 3 :
284
+ return "3.0" ;
285
+ case 4 :
286
+ return "3.2" ;
287
+ case 5 :
288
+ return "3.4" ;
289
+ case 6 :
290
+ return "3.6" ;
291
+ case 7 :
292
+ return "4.0" ;
293
+ case 8 :
294
+ return "4.2" ;
295
+ case 9 :
296
+ return "4.4" ;
297
+ case 10 :
298
+ return "4.7" ;
299
+ case 11 :
300
+ return "4.8" ;
301
+ case 12 :
302
+ return "4.9" ;
303
+ case 13 :
304
+ return "5.0" ;
305
+ case 14 :
306
+ return "5.1" ;
307
+ default :
308
+ return "Unknown" ;
309
+ }
310
+ }
311
+
312
+
271
313
/* Get "serverId" from opts. Sets *server_id to the serverId from "opts" or 0
272
314
* if absent. On error, fills out *error with domain and code and return false.
273
315
*/
You can’t perform that action at this time.
0 commit comments