-
Type:
Bug
-
Resolution: Won't Fix
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
>>> coll = client.t.t
>>> coll.drop()
>>> coll.insert_one({'a':{'b':1}})
<pymongo.results.InsertOneResult object at 0x105d3b648>
>>> coll.replace_one({'a.b': 1}, {'a':{'b':1}, 'dot.field': 1})
<pymongo.results.UpdateResult object at 0x105d3bec8>
>>> coll.find_one()
{'_id': ObjectId('5d44b3f721304a61efd54702'), 'a': {'b': 1}, 'dot.field': 1}
The expected behavior should be a client side validation error, like this:
>>> coll.insert_one({'dot.field': 2})
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/collection.py", line 693, in insert_one
session=session),
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/collection.py", line 607, in _insert
bypass_doc_val, session)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/collection.py", line 595, in _insert_one
acknowledged, _insert_command, session)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/mongo_client.py", line 1243, in _retryable_write
return self._retry_with_session(retryable, func, s, None)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/mongo_client.py", line 1196, in _retry_with_session
return func(session, sock_info, retryable)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/collection.py", line 590, in _insert_command
retryable_write=retryable_write)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/pool.py", line 584, in command
self._raise_connection_failure(error)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/pool.py", line 745, in _raise_connection_failure
raise error
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/pool.py", line 579, in command
unacknowledged=unacknowledged)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/network.py", line 114, in command
codec_options, ctx=compression_ctx)
File "/Users/shane/Library/Python/3.7/lib/python/site-packages/pymongo/message.py", line 679, in _op_msg
flags, command, identifier, docs, check_keys, opts)
bson.errors.InvalidDocument: key 'dot.field' must not contain '.'
- is related to
-
PYTHON-2346 replace_one does not validate all keys for update operators
-
- Closed
-
- links to