diff --git a/lib/results.js b/lib/results.js index c5f3f7e4..4f682bb7 100644 --- a/lib/results.js +++ b/lib/results.js @@ -14,7 +14,7 @@ function create(realmId, info) { let size = info.size; results[realmKey] = realmId; - results[idKey] = info.resultsId; + results[idKey] = info.id; results[resizeListKey](size); diff --git a/src/RealmRPC.mm b/src/RealmRPC.mm index d50d7e9a..d38d664e 100644 --- a/src/RealmRPC.mm +++ b/src/RealmRPC.mm @@ -239,10 +239,10 @@ using RPCRequest = std::function; } JSObjectRef jsObject = JSValueToObject(_context, value, NULL); - RPCObjectID oid = [self storeObject:jsObject]; if (JSValueIsObjectOfClass(_context, value, RJSObjectClass())) { realm::Object *object = RJSGetInternal(jsObject); + RPCObjectID oid = [self storeObject:jsObject]; return @{ @"type": @(RJSTypeGet(realm::PropertyTypeObject).c_str()), @"id": @(oid), @@ -251,6 +251,7 @@ using RPCRequest = std::function; } else if (JSValueIsObjectOfClass(_context, value, RJSArrayClass())) { realm::ObjectArray *array = RJSGetInternal(jsObject); + RPCObjectID oid = [self storeObject:jsObject]; return @{ @"type": @(RJSTypeGet(realm::PropertyTypeArray).c_str()), @"id": @(oid), @@ -260,9 +261,10 @@ using RPCRequest = std::function; } else if (JSValueIsObjectOfClass(_context, value, RJSResultsClass())) { realm::Results *results = RJSGetInternal(jsObject); + RPCObjectID oid = [self storeObject:jsObject]; return @{ @"type": @"ObjectTypesRESULTS", - @"resultsId": @(oid), + @"id": @(oid), @"size": @(results->size()), @"schema": [self objectSchemaToJSONObject:results->object_schema] };