I have a C# 9.0 record and when trying to save it, I get the following exception from RavenDB's client:
Raven.Server.Rachis.RachisApplyException: In ClusterTransactionDataCommand document id cannot be null, empty or white spaces as part of cluster transaction. Type:(PUT), Index:(0)
at Raven.Server.ServerWide.Commands.ClusterTransactionCommand.ClusterCommandValidation(ClusterTransactionDataCommand command, Char identityPartsSeparator)
at Raven.Server.ServerWide.Commands.ClusterTransactionCommand..ctor(String databaseName, Char identityPartsSeparator, String recordId, ArraySegment`1 commandParsedCommands, ClusterTransactionOptions options, String uniqueRequestId)
at Raven.Server.Documents.Handlers.BatchHandler.HandleClusterTransaction(DocumentsOperationContext context, MergedBatchCommand command, ClusterTransactionOptions options)
at Raven.Server.Documents.Handlers.BatchHandler.BulkDocs()
at Raven.Server.Routing.RequestRouter.HandlePath(RequestHandlerContext reqCtx)
at Raven.Server.RavenServerStartup.RequestHandler(HttpContext context). Response: {"Url":"/databases/InPremDev/bulk_docs?raft-request-id=007ae1cf-c947-4ef9-ad4b-c022087a1460","Type":"Raven.Server.Rachis.RachisApplyException","Message":"In ClusterTransactionDataCommand document id cannot be null, empty or white spaces as part of cluster transaction. Type:(PUT), Index:(0)","Error":"Raven.Server.Rachis.RachisApplyException: In ClusterTransactionDataCommand document id cannot be null, empty or white spaces as part of cluster transaction. Type:(PUT), Index:(0)\r\n at Raven.Server.ServerWide.Commands.ClusterTransactionCommand.ClusterCommandValidation(ClusterTransactionDataCommand command, Char identityPartsSeparator)\r\n at Raven.Server.ServerWide.Commands.ClusterTransactionCommand..ctor(String databaseName, Char identityPartsSeparator, String recordId, ArraySegment`1 commandParsedCommands, ClusterTransactionOptions options, String uniqueRequestId)\r\n at Raven.Server.Documents.Handlers.BatchHandler.HandleClusterTransaction(DocumentsOperationContext context, MergedBatchCommand command, ClusterTransactionOptions options)\r\n at Raven.Server.Documents.Handlers.BatchHandler.BulkDocs()\r\n at Raven.Server.Routing.RequestRouter.HandlePath(RequestHandlerContext reqCtx)\r\n at Raven.Server.RavenServerStartup.RequestHandler(HttpContext context)"}
The record looks like the following code snippet. Is this because a record instance is an immutable entity?
public record Model(string Id);
public record User
(
int UserId,
string Id,
string Login
) : Model(Id);
What is the solution for this problem?