db.test.insert_one({'x': 1})
---------------------------------------------------------------------------
OperationFailure Traceback (most recent call last)
<ipython-input-4-18c5347716d4> in <module>()
1 db.test.insert_one(
)
...\lib\site-packages\pymongo\collection.py in insert_one(self, document, bypass_document_validation, session)
691 write_concern=write_concern,
692 bypass_doc_val=bypass_document_validation,
--> 693 session=session),
694 write_concern.acknowledged)
695
...\lib\site-packages\pymongo\collection.py in _insert(self, docs, ordered, check_keys, manipulate, write_concern, op_id, bypass_doc_val, session)
605 return self._insert_one(
606 docs, ordered, check_keys, manipulate, write_concern, op_id,
--> 607 bypass_doc_val, session)
608
609 ids = []
...\lib\site-packages\pymongo\collection.py in _insert_one(self, doc, ordered, check_keys, manipulate, write_concern, op_id, bypass_doc_val, session)
593
594 self.__database.client._retryable_write(
--> 595 acknowledged, _insert_command, session)
596
597 if not isinstance(doc, RawBSONDocument):
...\lib\site-packages\pymongo\mongo_client.py in _retryable_write(self, retryable, func, session)
1241 """Internal retryable write helper."""
1242 with self._tmp_session(session) as s:
-> 1243 return self._retry_with_session(retryable, func, s, None)
1244
1245 def __reset_server(self, address):
...\lib\site-packages\pymongo\mongo_client.py in _retry_with_session(self, retryable, func, session, bulk)
1194 # Reset the transaction id and retry the operation.
1195 session._retry_transaction_id()
-> 1196 return func(session, sock_info, retryable)
1197 except ServerSelectionTimeoutError:
1198 if is_retrying():
...\lib\site-packages\pymongo\collection.py in _insert_command(session, sock_info, retryable_write)
588 session=session,
589 client=self.__database.client,
--> 590 retryable_write=retryable_write)
591
592 _check_write_command_response(result)
...\lib\site-packages\pymongo\pool.py in command(self, dbname, spec, slave_ok, read_preference, codec_options, check, allowable_errors, check_keys, read_concern, write_concern, parse_write_concern_error, collation, session, client, retryable_write, publish_events)
577 compression_ctx=self.compression_context,
578 use_op_msg=self.op_msg_enabled,
--> 579 unacknowledged=unacknowledged)
580 except OperationFailure:
581 raise
...\lib\site-packages\pymongo\network.py in command(sock, dbname, spec, slave_ok, is_mongos, read_preference, codec_options, session, client, check, allowable_errors, address, check_keys, listeners, max_bson_size, read_concern, parse_write_concern_error, collation, compression_ctx, use_op_msg, unacknowledged)
148 helpers._check_command_response(
149 response_doc, None, allowable_errors,
--> 150 parse_write_concern_error=parse_write_concern_error)
151 except Exception as exc:
152 if publish:
...\lib\site-packages\pymongo\helpers.py in _check_command_response(response, msg, allowable_errors, parse_write_concern_error)
153
154 msg = msg or "%s"
--> 155 raise OperationFailure(msg % errmsg, code, response)
156
157
OperationFailure: The documents option is required to the insert command.