Hey Alexander, this is due to a bit of an awkwardness due to the lack of NuGet support in Unity. Essentially, MongoDB.Bson
is a NuGet package and we can’t request it as a dependency in UPM, which is why we decided to cater to the majority use case, which is to bundle all dependencies of Realm into the dll distributed for Unity. For all of them except MongoDB.Bson we internalize the public members, so you shouldn’t get conflicts. We don’t do this for MongoDB.Bson because you need to be able to use some of the types there (e.g. ObjectId
, Decimal128
, etc.).
So there are two main ways to handle this - one approach would be to remove the MongoDB.Bson.dll that you’ve added to your project. Not sure how you’re installing the driver, but if you keep the dlls for the other driver packages, but remove MongoDB.Bson, Unity should be able to find it inside the Realm.dll
. Alternatively, you can unpack the Realm upm package, remove the Realm.dll, then replace it with the Realm.dll from our NuGet package. You’ll also need to download the dlls for our other dependencies - as listed here: https://github.com/realm/realm-dotnet/blob/71158b7c46513c5574dcdd190190c1eca41d9632/Tools/SetupUnityPackage/CommandLineOptions/RealmOptions.cs#L51-L58 (except MongoDB.Bson, of course). Then you can add the modified package from disk to UPM and that should resolve the conflict.