Skip to content

Unable to create documents with server generated UUID's #198

@paul-old

Description

@paul-old

We want to store documents and let RavenDB assign Guid identifiers to the documents. From the documentation:

Then, you have to provide the string.Empty as the value of the Id property

We have tried setting the Id = "" but receive the error below when saving changes. However, the document is correctly stored in the database with id() = guid and Id = "".
Setting Id = None the document stores without an error but the id() and Id are set to the form: products/1-A.

Traceback:
File "raven_crud.py", line 77, in store_registration
session.save_changes()
File "ravendb/documents/session/document_session.py", line 134, in save_changes
save_changes_operation.set_result(command.result)
File "ravendb/documents/operations/batch.py", line 72, in set_result
self.__on_successful_request.clear_session_state_after_successful_save_changes()
File "ravendb/documents/session/document_session_operations/in_memory_document_session_operations.py", line 1825, in clear_session_state_after_successful_save_changes
self.__session._documents_by_id.pop(key)
File "ravendb/tools/utils.py", line 192, in pop
return super(CaseInsensitiveDict, self).pop(self.class._lower_if_str(key), *args, **kwargs)
KeyError: ''

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions