Skip to content

Commit 3ba24a3

Browse files
authored
Merge pull request #1240 from yileicn/master
optimize mongodb
2 parents 576b610 + c25ff81 commit 3ba24a3

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/Plugins/BotSharp.Plugin.MongoStorage/MongoStoragePlugin.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using BotSharp.Abstraction.Repositories.Enums;
22
using BotSharp.Abstraction.Repositories.Settings;
33
using BotSharp.Plugin.MongoStorage.Repository;
4+
using MongoDB.Bson.Serialization.Conventions;
45

56
namespace BotSharp.Plugin.MongoStorage;
67

@@ -21,6 +22,9 @@ public void RegisterDI(IServiceCollection services, IConfiguration config)
2122

2223
if (dbSettings.Default == RepositoryEnum.MongoRepository)
2324
{
25+
var conventionPack = new ConventionPack { new IgnoreExtraElementsConvention(true) };
26+
ConventionRegistry.Register("IgnoreExtraElements", conventionPack, type => true);
27+
2428
services.AddSingleton((IServiceProvider x) =>
2529
{
2630
return new MongoDbContext(dbSettings);

0 commit comments

Comments
 (0)