Realm 12.0.0

dotnet add package Realm --version 12.0.0
NuGet\Install-Package Realm -Version 12.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Realm" Version="12.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Realm --version 12.0.0
#r "nuget: Realm, 12.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Realm as a Cake Addin
#addin nuget:?package=Realm&version=12.0.0

// Install Realm as a Cake Tool
#tool nuget:?package=Realm&version=12.0.0

<picture> <source srcset="./media/logo-dark.svg" media="(prefers-color-scheme: dark)" alt="realm by MongoDB"> <img src="./media/logo.svg" alt="realm by MongoDB"> </picture>

Realm is a mobile database that runs directly on phones, tablets or wearables. It supports all major mobile and desktop operating systems, such as iOS, Android, UWP, macOS, Linux, and Windows. For a full list of supported platforms and their versions, check out the Supported Platforms sub-section in the documentation.


  • Mobile-first: Realm is the first database built from the ground up to run directly inside phones, tablets, and wearables.
  • Simple: Data is directly exposed as objects and queryable by code, removing the need for ORM's riddled with performance & maintenance issues. Plus, we've worked hard to keep our API down to just a few common classes: most of our users pick it up intuitively, getting simple apps up & running in minutes.
  • Modern: Realm supports relationships, generics, vectorization and modern C# idioms.
  • Fast: Realm is faster than even raw SQLite on common operations while maintaining an extremely rich feature set.
  • Device Sync: Makes it simple to keep data in sync across users, devices, and your backend in real-time. Get started for free with a template application and create the cloud backend.

Getting Started

Model definition

Define a persistable model by inheriting from IRealmObject. The Realm source generator will generate an implementation for most of the functionality, so you only need to specify the properties you want to persist:

public partial class Person : IRealmObject
    public ObjectId Id { get; private set; } = ObjectId.GenerateNewId();

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public DateTimeOffset Birthday { get; set; }

    // You can define constructors as usual
    public Person(string firstName, string lastName)
        FirstName = firstName;
        LastName = lastName;

Open a Realm file

Open a Realm instance by calling Realm.GetInstance:

// You can provide a relative or an absolute path to the Realm file or let
// Realm use the default one.
var realm = Realm.GetInstance("people.realm");

CRUD operations

Add, read, update, and remove objects by calling the corresponding API on the Realm instance:

// Always mutate the Realm instance in a write transaction
realm.Write(() =>
    realm.Add(new Person("John", "Smith"));

var peopleWithJ = realm.All<Person>().Where(p => p.FirstName.StartsWith("J"));

// All Realm collections and objects are reactive and implement INotifyCollectionChanged/INotifyPropertyChanged

peopleWithJ.AsRealmCollection().CollectionChanged += (s, e) =>
    // React to notifications

For more examples, see the detailed instructions in our User Guide to add Realm to your solution.


The documentation can be found at The API reference is located at

Getting Help

  • Need help with your code?: Look for previous questions on the #realm tag — or ask a new question. You can also check out our Community Forum where general questions about how to do something can be discussed.
  • Have a bug to report? Open an issue. If possible, include the version of Realm, a full log, the Realm file, and a project that shows the issue.
  • Have a feature request? Open an issue. Tell us what the feature should do, and why you want the feature.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net46 is compatible.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid is compatible. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios is compatible. 
Xamarin.Mac xamarinmac is compatible. 
Xamarin.TVOS xamarintvos is compatible. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (39)

Showing the top 5 NuGet packages that depend on Realm:

Package Downloads

Package Description


This framework allows you to bind your Android or iOS device with i360RockSTAR tracker


ItEnterprise Common.CoreStandard for Xamarin Forms


Arc4u Diagnostics Serilog Sink to RealmDB


ItEnterprise WmsStandard for Xamarin Forms

GitHub repositories (5)

Showing the top 5 popular GitHub repositories that depend on Realm:

Repository Stars
rhythm is just a *click* away!
Realm is a mobile database: a replacement for SQLite & ORMs
XML, NEWS, RSS & Scrapping Reader maked in Xamarin, for educational purpose.
The official Realm Draw app used in promotional videos
Hangul Clock for Windows Desktop Widget
Version Downloads Last updated
12.0.0 1,088 4/17/2024
11.7.0 49,369 2/5/2024
11.6.1 59,812 11/17/2023
11.6.0 12,258 11/4/2023
11.5.0 163,787 9/16/2023
11.4.0 23,858 8/16/2023
11.3.0 32,027 7/26/2023
11.2.0 14,850 7/8/2023
11.1.2 96,474 6/20/2023
11.1.1 5,705 6/19/2023
11.1.0 2,609 6/17/2023
11.0.0 36,778 5/8/2023
10.21.1 32,894 4/21/2023
10.21.0 22,299 3/24/2023
10.20.0 86,174 2/10/2023
10.19.0 32,187 1/6/2023
10.18.0 124,134 11/2/2022
10.17.0 85,478 10/6/2022
10.16.0 12,592 10/3/2022
10.15.1 104,204 8/8/2022
10.15.0 5,526 8/5/2022
10.14.0 171,492 6/2/2022
10.13.0 26,916 5/18/2022
10.12.0 18,075 5/5/2022
10.11.2 34,661 4/21/2022
10.11.1 20,613 3/31/2022
10.11.0 5,401 3/28/2022
10.10.0 94,436 2/28/2022
10.9.0 73,226 1/21/2022
10.8.0 37,669 1/17/2022
10.7.1 101,729 11/20/2021
10.7.0 7,111 11/10/2021
10.6.0 157,986 9/30/2021
10.5.1 17,996 9/22/2021
10.5.0 30,524 9/9/2021
10.4.1 3,681 9/3/2021
10.4.0 11,259 8/31/2021
10.3.0 137,285 7/7/2021
10.2.1 26,676 7/1/2021
10.2.0 26,520 6/15/2021
10.2.0-beta.2 761 5/5/2021
10.2.0-beta.1 350 4/12/2021
10.1.4 19,053 5/12/2021
10.1.3 20,264 4/29/2021
10.1.2 29,368 3/19/2021
10.1.1 22,066 2/25/2021
10.1.0 13,090 2/9/2021
10.0.1 6,834 2/2/2021
10.0.0-beta.6 430 1/26/2021
10.0.0-beta.5 636 1/19/2021
10.0.0-beta.3 1,151 12/10/2020
10.0.0-beta.2 1,464 11/4/2020
10.0.0-beta.1 727 10/16/2020
10.0.0-alpha.43 360 10/9/2020
10.0.0-alpha.34 470 10/4/2020
5.1.3 24,853 2/10/2021
5.1.2 83,449 10/20/2020
5.1.1 27,512 10/2/2020
5.1.0 6,552 9/30/2020
5.0.1 10,720 9/9/2020
4.3.0 270,486 2/5/2020
4.2.0 69,639 10/8/2019
4.1.0 86,397 8/6/2019
4.0.1 19,979 6/27/2019
4.0.0 6,256 6/14/2019
3.4.0 101,102 1/9/2019
3.3.0 26,280 11/8/2018
3.2.1 43,979 9/27/2018
3.2.0 15,184 9/4/2018
3.1.0 32,485 7/4/2018
3.0.0 108,364 4/16/2018
2.2.0 12,693 3/22/2018
2.1.0 54,577 11/13/2017
2.0.0 18,270 10/17/2017
2.0.0-rc1 2,572 10/3/2017
1.6.0 35,387 8/15/2017
1.5.0 17,975 6/20/2017
1.4.0 14,880 5/19/2017
1.3.0 3,722 5/16/2017
1.2.1 7,937 5/1/2017
1.2.0 5,946 4/4/2017
1.1.1 7,497 3/15/2017
1.1.0 3,650 3/3/2017
1.0.4 4,880 2/21/2017
1.0.3 17,054 2/14/2017
0.82.1 18,468 1/27/2017
0.82.0 3,338 1/23/2017
0.81.0 5,428 12/15/2016
0.80.0 11,534 10/27/2016
0.78.1 20,583 9/15/2016
0.78.0 2,744 9/11/2016
0.77.2 5,616 8/11/2016
0.77.1 3,176 7/28/2016
0.76.1 6,070 6/15/2016
0.76.0 3,386 6/9/2016
0.75.0 3,216 6/3/2016
0.74.1 5,789 5/10/2016

## 12.0.0 (2024-04-17)

**File format version bumped. Old files will be automatically upgraded but cannot be downgraded and opened with older versions of the .NET SDK.**

### Breaking Changes
* Added automatic serialization and deserialization of Realm classes when using methods on `MongoClient.Collection`, without the need to annotate classes with `MongoDB.Bson`attributes. This feature required to change the default serialization for various types (including `DateTimeOffset`). If you prefer to use the previous serialization, you need to call `Realm.SetLegacySerialization` before any kind of serialization is done, otherwise it may not work as epxected. [#3459](
* `SyncProgress.TransferredBytes` and `SyncProgress.TransferableBytes` have been removed in favour of `SyncProgress.ProgressEstimate`, a double value between 0.0 and 1.0 that expresses the percentage estimate of the current progress. (Issue [#3478](]))
* Support for upgrading from Realm files produced by RealmCore v5.23.9 (Realm .NET v5.0.1) or earlier is no longer supported. (Core 14.0.0)
* `String` and `byte[]` are now strongly typed for comparisons and queries. This change is especially relevant when querying for a string constant on a `RealmValue` property, as now only strings will be returned. If searching for binary data is desired, then that type must be specified by the constant. In RQL (`.Filter()`) the new way to specify a binary constant is to use `RealmValueProp = bin('xyz')` or `RealmValueProp = binary('xyz')`. (Core 14.0.0)
* Sorting order of strings has changed to use standard unicode codepoint order instead of grouping similar english letters together. A noticeable change will be from "aAbBzZ" to "ABZabz". (Core 14.0.0)
* In RQL (`Filter()`), if you want to query using `@type` operation, you must use `objectlink` to match links to objects. `object` is reserved for dictionary types. (Core 14.0.0)
* Opening realm with file format 23 or lower (Realm .NET versions earlier than 12.0.0) in read-only mode will crash. (Core 14.0.0)

### Enhancements
* Reduced memory usage of `RealmValue`. (PR [#3441](
* Add support for passing a key paths collection (`KeyPathsCollection`) when using `IRealmCollection.SubscribeForNotifications`. Passing a `KeyPathsCollection` allows to specify which changes in properties should raise a notification.

 A `KeyPathsCollection` can be obtained by:
 - building it explicitly by using the methods `KeyPathsCollection.Of` or `KeyPathsCollection.Of<T>`;
 - building it implicitly with the conversion from a `List` or array of `KeyPath` or strings;
 - getting one of the static values `Full` and `Shallow` for full and shallow notifications respectively.

 A `KeyPath` can be obtained by implicit conversion from a string or built from an expression using the `KeyPath.ForExpression<T>` method.

 For example:
 var query = realm.All<Person>();

 KeyPath kp1 = "Email";
 KeyPath kp2 = KeyPath.ForExpression<Person>(p => p.Name);

 KeyPathsCollection kpc;

 //Equivalent declarations
 kpc = KeyPathsCollection.Of("Email", "Name");
 kpc = KeyPathsCollection.Of<Person>(p => p.Email, p => p.Name);
 kpc = new List<KeyPath> {"Email", "Name"};
 kpc = new List<KeyPath> {kp1, kp2};

 query.SubscribeForNotifications(NotificationCallback, kpc);
 (PR [#3501 ](
* Added the `MongoClient.GetCollection<T>` method to get a collection of documents from MongoDB that can be deserialized in Realm objects. This methods works the same as `MongoClient.GetDatabase(dbName).GetCollection(collectionName)`, but the database name and collection name are automatically derived from the Realm object class.  [#3414](
* Improved performance of RQL (`.Filter()`) queries on a non-linked string property using: >, >=, <, <=, operators and fixed behaviour that a null string should be evaulated as less than everything, previously nulls were not matched. (Core 13.27.0)
* Updated bundled OpenSSL version to 3.2.0. (Core 13.27.0)
* Storage of Decimal128 properties has been optimised so that the individual values will take up 0 bits (if all nulls), 32 bits, 64 bits or 128 bits depending on what is needed. (Core 14.0.0)
* Add support for collection indexes in RQL (`Filter()`) queries.
 For example:
 var people = realm.All<Person>();

 //People whose first dog is called "Fluffy"
 var query1 = people.Filter("ListOfDogs[FIRST].Name = $0", "Fluffy")

 //People whose last dog is called "Fluffy"
 var query2 = people.Filter("ListOfDogs[LAST].Name = $0", "Fluffy")

 //People whose second dog is called "Fluffy"
 var query3 = people.Filter("ListOfDogs[2].Name = $0", "Fluffy")

 //People that have a dog called "Fluffy"
 var query4 = people.Filter("ListOfDogs[*].Name = $0", "Fluffy")

 //People that have 3 dogs
 var query5 = people.Filter("ListOfDogs[SIZE] = $0", 3)
 (Core 14.0.0)
* Added support for indexed `RealmValue` properties. (PR [#3544](
* Improve performance of object notifiers with complex schemas and very simple changes to process by as much as 20%. (Core 14.2.0)
* Improve performance with very large number of notifiers as much as 75%. (Core 14.2.0)
* Improve file compaction performance on platforms with page sizes greater than 4k (for example arm64 Apple platforms) for files less than 256 pages in size. (Core 14.4.0)
* The default base url in `AppConfiguration` has been updated to point to ``. See for more information. (Issue [#3551](

### Fixed
* Fixed RQL (`.Filter()`) queries like `indexed_property == NONE {x}` which mistakenly matched on only x instead of not x. This only applies when an indexed property with equality (==, or IN) matches with `NONE` on a list of one item. If the constant list contained more than one value then it was working correctly. (Core 13.27.0)
* Uploading the changesets recovered during an automatic client reset recovery may lead to 'Bad server version' errors and a new client reset. (Core 13.27.0)
* Fixed crash in fulltext index using prefix search with no matches. (Core 13.27.0)
* Fixed a crash with Assertion `failed: m_initiated` during sync session startup. (Core 13.27.0)
* Fixed a TSAN violation where the user thread could race to read m_finalized with the sync event loop. (Core 13.27.0)
* Fix a minor race condition when backing up Realm files before a client reset which could have lead to overwriting an existing file. (Core 13.27.0)
* Boolean property `ChangeSet.IsCleared` that is true when the collection gets cleared is now also raised for `IDictionary`, aligning it to `ISet` and `IList`. (Core 14.0.0)
* Fixed equality queries on `RealmValue` properties with an index. (Core 14.0.0)
* Fixed a crash that would happen when more than 8388606 links were pointing to a specific object.
* Fixed wrong results when querying for `NULL` value in `IDictionary`. (Core 14.0.0)
* A Realm generated on a non-apple ARM 64 device and copied to another platform (and vice-versa) were non-portable due to a sorting order difference. This impacts strings or binaries that have their first difference at a non-ascii character. These items may not be found in a set, or in an indexed column if the strings had a long common prefix (> 200 characters). (Core 14.0.0)
* Fixed an issue when removing items from a LnkLst that could result in invalidated links becoming visable which could cause crashes or exceptions when accessing those list items later on. This affects sync Realms where another client had previously removed a link in a linklist that has over 1000 links in it, and then further local removals from the same list caused the list to have fewer than 1000 items. (Core 14.2.0)
* Fix a spurious crash related to opening a Realm on background thread while the process was in the middle of exiting. (Core 14.3.0)
* Fix opening realm with cached user while offline results in fatal error and session does not retry connection. (Core 14.4.0)
* Fix an assertion failure "m_lock_info && m_lock_info->m_file.get_path() == m_filename" that appears to be related to opening a Realm while the file is in the process of being closed on another thread. (Core 14.5.0)
* Fixed diverging history due to a bug in the replication code when setting default null values (embedded objects included). (Core 14.5.0)
* Null pointer exception may be triggered when logging out and async commits callbacks not executed. (Core 14.5.0)

### Compatibility
* Realm Studio: 15.0.0 or later.

### Internal
* Using Core 14.5.1.