Changelog
12.0.0-rc.0 (2023-06-29)
Realm
to use default or * as Realm
imports of the Realm
constructor. (#5882)SyncSession
JS objects no longer keep their associated C++ objects, and therefore the sync network connection, alive. This was causing issues because JS garbage collection is lazy so the SyncSession
may survive much longer than the last reference held to it. We now use the same technique as v11 to avoid keeping the C++ object alive (std::weak_ptr
). (#5815, since v12.0.0-alpha.0)
undefined
or some other default value when calling methods or accessing properties on the JS SyncSession
object, even if that would violate our declared TS types. Now, in v12, we will throw from all methods and property accessors in this case.SubscriptionsState
enum (will be removed in v13) in favor of the now-named SubscriptionSetState
. (#5773)Realm
namespace, to align with v11 and ease the adoption of this major version. (#5883)Opening a Realm with invalid schemas will throw a SchemaParseError
(or one of its subtypes ObjectSchemaParseError
and PropertySchemaParseError
) rather than an AssertionError
or Error
. (#5198)
Enable multiple processes to operate on an encrypted Realm simultaneously. (realm/realm-core#1845)
Added Realm.setLogger
, that allows to setup a single static logger for the duration of the app lifetime. Differently from the now deprecated sync logger (that was setup with Sync.setLogger
), this new one will emit messages coming also from the local database, and not only from sync. It is also possible to change the log level during the whole duration of the app lifetime with Realm.setLogLevel
. (#2546)
Added support for a sync configuration option to provide an SSLConfiguration
with a custom function for validating the server's SSL certificate. (#5485)
Improve performance of equality queries on a non-indexed mixed property by about 30%. (realm/realm-core#6506)
Improve performance of rolling back write transactions after making changes. (realm/realm-core#6513)
Extended PropertySchema.indexed
with the full-text
option, that allows to create an index for full-text search queries. (#5755)
Access token refresh for websockets was not updating the location metadata. (realm/realm-core#6630, since v11.9.0)
Fix several UBSan failures which did not appear to result in functional bugs. (realm/realm-core#6649).
Using both synchronous and asynchronous transactions on the same thread or scheduler could hit an assertion failure if one of the callbacks for an asynchronous transaction happened to be scheduled during a synchronous transaction (realm/realm-core#6659, since v10.12.0)
Added APIs to facilitate adding and removing subscriptions. (#5772)
Results
instance via Results.subscribe()
(asynchronous) and Results.unsubscribe()
(synchronous).
WaitForSync
enum specifying whether to wait or not wait for subscribed objects to be downloaded before resolving the promise returned from Results.subscribe()
.SubscriptionOptions
to take a WaitForSync
behavior and a maximum waiting timeout before returning from Results.subscribe()
.MutableSubscriptionSet.removeUnnamed()
for removing only unnamed subscriptions.const peopleOver20 = await realm
.objects("Person")
.filtered("age > 20")
.subscribe({
name: "peopleOver20",
behavior: WaitForSync.FirstTime, // Default
timeout: 2000,
});
// ...
peopleOver20.unsubscribe();
Added initial support for geospatial queries, with the possibility of querying points. No new data type has been added in this phase, but every embedded object property that conforms to CanonicalGeoPoint
can be queried. (#5850)
geoWithin
operator in the query string to Results.filtered()
.GeoCircle
type, defined by its center and radius in radians), box (GeoBox
type, defined by its bottom left and upper right corners) and polygon (GeoPolygon
type, defined by its vertices).kmToRadians()
and miToRadians()
, that can be used to convert kilometers and miles to radians respectively, simplifying conversion of a circle's radius.import Realm, {
ObjectSchema,
GeoCircle,
CanonicalGeoPoint,
GeoPosition,
kmToRadians,
} from "realm";
// Example of a user-defined point class that can be queried using geospatial queries
class MyGeoPoint extends Realm.Object implements CanonicalGeoPoint {
coordinates!: GeoPosition;
type = "Point" as const;
static schema: ObjectSchema = {
name: "MyGeoPoint",
embedded: true,
properties: {
type: "string",
coordinates: "double[]",
},
};
}
class PointOfInterest extends Realm.Object {
name!: string;
location!: MyGeoPoint;
static schema: ObjectSchema = {
name: "PointOfInterest",
properties: {
name: "string",
location: "MyGeoPoint",
},
};
}
realm.write(() => {
realm.create(PointOfInterest, {
name: "Copenhagen",
location: {
coordinates: [12.558892784045568, 55.66717839648401],
type: "Point",
} as MyGeoPoint
});
realm.create(PointOfInterest, {
name: "New York",
location: {
coordinates: [-73.92474936213434, 40.700090994927415],
type: "Point",
} as MyGeoPoint
});
});
const pois = realm.objects(PointOfInterest);
const berlinCoordinates: GeoPoint = [13.397255909303222, 52.51174463251085];
const radius = kmToRadians(500); //500 km = 0.0783932519 rad
// Circle with a radius of 500kms centered in Berlin
const circleShape: GeoCircle = {
center: berlinCoordinates,
distance: radius,
};
// All points of interest in a 500kms radius from Berlin
let result = pois.filtered("location geoWithin $0", circleShape);
// Equivalent string query without arguments
result = pois.filtered("location geoWithin geoCircle([13.397255909303222, 52.51174463251085], 0.0783932519)");
Support sort/distinct based on values from a dictionary e.g. TRUEPREDICATE SORT(meta['age'])
. (realm/realm-core#5311)
Support for HTTP proxy settings in the Realm configuration by adding proxyConfig
to the sync configuration. You can continue to use environment variable HTTPS_PROXY
. HTTP proxies are only supported for node.js and Electron. (#5816)
proxyConfig: {
address: "127.0.0.1",
port: 9876,
type: ProxyType.HTTP,
}
Realm
was still open (realm/realm-core#6050).User.state
and changed the UserState
enum values to use pascal case to conform to the v11 implementation (except for UserState.Active
that we now deprecate in favor of UserState.LoggedIn
). (#5686)indexOf
a missing value will no longer return 4294967295
instead of -1
and the Set#has
will no longer return true
when missing. Caused by an incorrect conversion of size_t
to Number
on x86 (32bit) architectures. (#5746, since 12.0.0-alpha.0)App.currentUser()
when being called on a new instance of App
(#5790)REALM_DISABLE_ANALYTICS
, and you can print out what is submitted by setting the environment variable REALM_PRINT_ANALYTICS
.Changelog
12.0.0-alpha.2 (2023-04-05)
SyncError.logUrl
which contains the URL to the server log related to the sync error. (#5609)CompensatingWriteError
which indicates that one or more object changes have been reverted by the server.
This can happen when the client creates/updates objects that do not match any subscription, or performs writes on an object it didn't have permission to access. (#5599)Realm.Results#length
) the number of exact matches (with no other query conditions) on a string
/int
/uuid
/objectId
property that has an index. This improvement will be especially noticeable if there are a large number of results returned (duplicate values).date
property that has an index.mixed
property that has an index.bool
property that has an index.mixed
property that does not have an index.THROW_ON_GLOBAL_REALM
which will enable throwing when the app is accessing the Realm
without first importing it from the Realm package.mixed
property with a string operator (contains
/like
/beginswith
/endswith
) or with case insensitivity. ([realm/realm-core#6376](https://github.com/realm/realm-core/issues/6376, since v10.5.0)mixed
property was returning case insensitive matches. For example querying for myIndexedMixed == "Foo"
would incorrectly match on values of "foo"
or "FOO"
. (realm/realm-core#6376, since v10.5.0)mixed
property on a non-empty class/objectType would crash with an assertion. (realm/realm-core#6376, since v10.5.0)Realm.App.Sync#pause()
could hold a reference to the database open after shutting down the sync session, preventing users from being able to delete the Realm. (realm/realm-core#6372, since v11.5.0)Realm.Results
and Realm.List
being in different orders on different devices. Moreover, some cases of the error message Invalid prior_size
may have be fixed too. (realm/realm-core#6191, since v10.15.0)Sync
as named export. #5649App.allUsers
to return a record with the User.id
as the key and the User
as the value. #5671