Unity SDK equivalent of builders in .NET

Hi @nirinchev,
I was integrating Unity SDK to my project a few days ago as well, and I’m facing some difficulties understanding what is the equivalent to Builders of .NET in Unity.

So for example, how would you convert the following operation which is valid on .NET SDK, to be valid on Unity SDK?

public virtual Task<TDocument> FindByIdAsync(string id)
    {
        return Task.Run(() =>
        {
            var objectId = new ObjectId(id);
            var filter = Builders<TDocument>.Filter.Eq(doc => doc.Id, objectId);
            return _collection.FindAsync(filter).SingleOrDefaultAsync();
        });
    } 

Thanks,
Or.

Hi @Or_Dvir,

It appears you’re looking for an API out of the C# driver that is not available in the Realm Unity SDK. The Realm Unity SDK allows you to store data locally on the device, query it, and, optionally, synchronize with MongoDB Atlas via Realm Sync.

While you can use the Realm SDK to query MongoDB directly, that functionality is just a wrapper around the REST API exposed by MongoDB Realm and is not intended as a replacement of the C# driver. The documentation for the MongoDB data access API can be found here.