Get IMongoDatabase from Realms.Sync.MongoClient.Database

What I have

  • An Atlas database with multiple collections and schema defined for each
  • Multiple clients (.NET, iOS, and Android) all connecting and synching well
  • A collection that users can upload binary files to which will sync to other users where appropriate

What I need

  • To upload large binary files using GridFS to the Atlas server

What I have

  • A working upload of GridFS files using a connection string that I’ve manually entered into the app’s configuration

What I want

  • To not need the connection string since I already have Device Sync working

Right now, I can get the authenticated user and use that to get a MongoClient and use that to get the database I want…
var db = Config.User.GetMongoClient("MyServiceName").GetDatabase("MyDatabaseName");

The problem is that this is a Realms.Sync.MongoClient.Database and when I try to instantiate GridFS I get a compiler error because it is expecting MongoDB.Driver.IMongoDatabase.

This is not urgent, because I can make it work with the connection string. But it seems bizarre to me that I can’t get to the Atlas server from a synched Realm.