Closed dupies closed 3 months ago
The problem was that my MongoDB database version was 3.7, which does not support top-level fields with a dollar sign ($). MongoDB versions 3.0 and 4.0 have similar restrictions. To resolve this issue, I had to upgrade my MongoDB to version 5.0, which supports such fields.
Description: I encountered an issue when trying to run a workflow using MongoDB for persistence in my Elsa project. The error does not occur when using SQLite. Below are the details of my setup and the error message.
Error Message: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1] An unhandled exception has occurred while executing the request. MongoDB.Driver.MongoBulkWriteException
1[Elsa.Workflows.Runtime.Entities.StoredTrigger]: A bulk write operation resulted in one or more errors. WriteErrors: [ { Category : "Uncategorized", Code : 52, Message : "The dollar ($) prefixed field '$type' in 'Payload.$type' is not valid for storage." } ]. at MongoDB.Driver.MongoCollectionImpl
1.BulkWriteAsync(IClientSessionHandle session, IEnumerable`1 requests, BulkWriteOptions options, CancellationToken cancellationToken)Program.cs:
Steps to Reproduce:
Additional Information: • The error does not occur when using SQLite for persistence. • The MongoDB server is running locally at mongodb://localhost:27017/workflow.
Expected Behavior: The workflow should execute without any errors.
Actual Behavior: A MongoBulkWriteException is thrown with the message: "The dollar ($) prefixed field '$type' in 'Payload.$type' is not valid for storage." Environment: • Elsa Version: 3.1.3 • Elsa.MongoDb 3.1.3 • .NET Version: 8.0.0
Elsa Server:
Elsa Studio