You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried implementing migrations on startup. However, I get this error: System.InvalidCastException: 'Unable to cast object of type 'MongoDB.Bson.BsonDocument' to type 'MongoDB.Bson.BsonString'.'
Stack trace:
at MongoDB.Bson.BsonValue.get_AsString()
at Mongo.Migration.Services.DocumentVersionService.GetVersionOrDefault(BsonDocument document)
at Mongo.Migration.Migrations.Document.DocumentMigrationRunner.Run(Type type, BsonDocument document, DocumentVersion to)
at Mongo.Migration.Migrations.Document.StartUpDocumentMigrationRunner.RunAll()
at Mongo.Migration.Services.MigrationService.OnStartup()
at Mongo.Migration.Services.MigrationService.Migrate()
at Mongo.Migration.MongoMigration.Run()
at Mongo.Migration.Startup.Static.MongoMigrationClient.Initialize(IComponentRegistry componentRegistry)
at Mongo.Migration.Startup.Static.MongoMigrationClient.Initialize(IMongoClient client, IMongoMigrationSettings settings, IContainerAdapter containerAdapter)
at Dialogue.Composer.Program.<>c__DisplayClass2_0.<CreateHost>b__0(HostBuilderContext context, IServiceCollection services) in C:\Dev\Microservices\Composer\Dialogue.Composer\Program.cs:line 118
What am I doing wrong here?
This is my init:
IMongoClient clientMongoDB = new MongoClient(databaseSettings.ConnectionString);
MongoMigrationClient.Initialize(clientMongoDB, new MongoMigrationSettings
{
ConnectionString = databaseSettings.ConnectionString,
Database = databaseSettings.DatabaseName
});
The text was updated successfully, but these errors were encountered:
I went through my whole mongo db and searched all documents that included the IDocument interface in c#.
The i went through my mongodb and went through every collection that was relevant untill i found a collection that had the versionProperty that was lik to "Version: {}"
So i suggest doing the same if you encounter this issue.
This error occured for my because i tried to create a custom version property that had the same name for a limited amount of time that corrupted the Version property
I have tried implementing migrations on startup. However, I get this error:
System.InvalidCastException: 'Unable to cast object of type 'MongoDB.Bson.BsonDocument' to type 'MongoDB.Bson.BsonString'.'
Stack trace:
What am I doing wrong here?
This is my init:
The text was updated successfully, but these errors were encountered: