From 3c657c3bbfd55a02ebe17799380f8f364c4cc723 Mon Sep 17 00:00:00 2001 From: Scott Kyle Date: Fri, 3 Jun 2016 16:59:50 -0700 Subject: [PATCH] Update docs and CHANGELOG with objectForPrimaryKey --- CHANGELOG.md | 1 + docs/realm.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42fd136d..4bc4b402 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ x.x.x Release notes (yyyy-MM-dd) ### Enhancements * Added `isValid()` method to `List` and `Results` to check for deleleted or invalidated objects +* Added `objectForPrimaryKey(type, key)` method to `Realm` ### Bugfixes * None diff --git a/docs/realm.js b/docs/realm.js index ade8d8a8..780e3243 100644 --- a/docs/realm.js +++ b/docs/realm.js @@ -106,6 +106,16 @@ class Realm { */ objects(type) {} + /** + * Searches for a Realm object by its primary key. + * @param {Realm~ObjectType} type - The type of Realm object to search for. + * @param {number|string} key - The primary key value of the object to search for. + * @throws {Error} If type passed into this method is invalid or if the object type did + * not have a `primaryKey` specified in its {@link Realm~ObjectSchema ObjectSchema}. + * @returns {Realm.Object|undefined} if no object is found. + */ + objectForPrimaryKey(type, key) {} + /** * Add a listener `callback` for the specified event `name`. * @param {string} name - The name of event that should cause the callback to be called.