Activities of "connect"

@EngincanV Thanks for sharing article. It works now.

No it doesn't help. I tried to run some small script as follows but still i getting the same error. I dropped my collections in local mongodb then it worked. How can i fix this to my production now?


public static class MongoDBGUIDMigrations
{
    public static async Task Migrate()
    {
       BsonSerializer.RegisterSerializer(new GuidSerializer(GuidRepresentation.Standard));

        var connectionString = "mongodb://localhost:27017"; // Replace as needed
        var dbName = "your-database-name"; // Replace with your DB name

        var settings = MongoClientSettings.FromConnectionString(connectionString);
        var client = new MongoClient(settings);
        var database = client.GetDatabase(dbName);

        // STEP 3: Get all collection names
        var collections = await database.ListCollectionNamesAsync();
        var collectionNames = await collections.ToListAsync();

        Console.WriteLine($"Found {collectionNames.Count} collections.");

        foreach (var collectionName in collectionNames)
        {
            Console.WriteLine($"\n🔄 Processing collection: {collectionName}");

            // Use BsonDocument to handle dynamic schemas
            var collection = database.GetCollection<BsonDocument>(collectionName);

            var documents = await collection.Find(FilterDefinition<BsonDocument>.Empty).ToListAsync();

            int updatedCount = 0;

            foreach (var doc in documents)
            {
                var id = doc.GetValue("_id", null);

                if (id == null)
                {
                    Console.WriteLine("Skipping document without _id");
                    continue;
                }

                // Replacing with same document will reserialize with Standard Guid format
                var filter = Builders<BsonDocument>.Filter.Eq("_id", id);
                await collection.ReplaceOneAsync(filter, doc);
                updatedCount++;
            }

            Console.WriteLine($"✅ Updated {updatedCount} documents in collection: {collectionName}");
        }

        Console.WriteLine("Migration complete. All documents now use UuidStandard format for Guids.");
    }
}

I'm using Linux, so I don't have access to ABP Studio yet.

I've upgraded my modules to ABP 9.2.0, and now I'm encountering the following error. I noticed that ABP 9.2.0 upgrades the MongoDB driver to v3.x, which changes the default GUID serialization behavior.

I already followed the official MongoDB documentation on GUID serialization: https://www.mongodb.com/docs/drivers/csharp/current/fundamentals/serialization/guid-serialization/#std-label-csharp-guids

However, that didn’t resolve the issue.

Has anyone else run into this? Any advice or guidance would be greatly appreciated!

Logo trace:

Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module C4ll.Me.MeModule, C4ll.Me, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: One or more errors occurred. (An error occurred while deserializing the Id property of class Volo.Abp.Domain.Entities.Entity1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]: Expected BsonBinarySubType to be UuidStandard, but it is UuidLegacy.). See the inner exception for details. ---> System.AggregateException: One or more errors occurred. (An error occurred while deserializing the Id property of class Volo.Abp.Domain.Entities.Entity1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]: Expected BsonBinarySubType to be UuidStandard, but it is UuidLegacy.) ---> System.FormatException: An error occurred while deserializing the Id property of class Volo.Abp.Domain.Entities.Entity`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]: Expected BsonBinarySubType to be UuidStandard, but it is UuidLegacy. ---> System.FormatException: Expected BsonBinarySubType to be UuidStandard, but it is UuidLegacy. at MongoDB.Bson.IO.BsonReader.ReadGuid(GuidRepresentation guidRepresentation)

Showing 1 to 3 of 3 entries
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.0.0-preview. Updated on September 01, 2025, 08:37