|
Sending the create command with a nonsensical write concern to a 3.7 replica set with three members results in a write concern error:
>>> c = pymongo.MongoClient()
|
>>> c.foo.command('create', 'bar', writeConcern={'w': 1000})
|
{'ok': 1.0, 'operationTime': Timestamp(1518570804, 1), 'writeConcernError': {'codeName': 'CannotSatisfyWriteConcern', 'errmsg': 'Not enough data-bearing nodes', 'code': 100}, '$clusterTime': {'signature': {'keyId': 0, 'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, 'clusterTime': Timestamp(1518570804, 1)}}
|
>>> c.admin.command('buildInfo')['version']
|
'3.7.1-370-gfab8bda846'
|
Sending the same command to a mongos in front of a single three member shard does not cause a write concern error:
>>> c = pymongo.MongoClient()
|
>>> c.foo.command('create', 'bar', writeConcern={'w': 1000})
|
{'ok': 1.0, '$clusterTime': {'signature': {'keyId': 0, 'hash': b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'}, 'clusterTime': Timestamp(1518571939, 3)}, 'operationTime': Timestamp(1518571939, 2)}
|
>>> c.admin.command('buildInfo')['version']
|
'3.7.1-370-gfab8bda846'
|
|