File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ const ReadConcern = require('../read_concern');
7
7
const WriteConcern = require ( '../write_concern' ) ;
8
8
const maxWireVersion = require ( '../core/utils' ) . maxWireVersion ;
9
9
const commandSupportsReadConcern = require ( '../core/sessions' ) . commandSupportsReadConcern ;
10
+ const MongoError = require ( '../error' ) . MongoError ;
10
11
11
12
const SUPPORTS_WRITE_CONCERN_AND_COLLATION = 5 ;
12
13
@@ -44,6 +45,17 @@ class CommandOperationV2 extends OperationBase {
44
45
Object . assign ( cmd , { readConcern : this . readConcern } ) ;
45
46
}
46
47
48
+ if ( options . collation && serverWireVersion < SUPPORTS_WRITE_CONCERN_AND_COLLATION ) {
49
+ callback (
50
+ new MongoError (
51
+ `Server ${
52
+ server . name
53
+ } , which reports wire version ${ serverWireVersion } , does not support collation`
54
+ )
55
+ ) ;
56
+ return ;
57
+ }
58
+
47
59
if ( serverWireVersion >= SUPPORTS_WRITE_CONCERN_AND_COLLATION ) {
48
60
if ( this . writeConcern && this . hasAspect ( Aspect . WRITE_OPERATION ) ) {
49
61
Object . assign ( cmd , { writeConcern : this . writeConcern } ) ;
You can’t perform that action at this time.
0 commit comments