From f683ef2432f7d00d239a62677f355ace67817ce7 Mon Sep 17 00:00:00 2001 From: Francisco Saldana Date: Fri, 6 Jan 2017 02:47:53 -0600 Subject: [PATCH 1/3] Don't override exists function --- lib/modules/database/snapshot.js | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/modules/database/snapshot.js b/lib/modules/database/snapshot.js index f963bf9..6746d1f 100644 --- a/lib/modules/database/snapshot.js +++ b/lib/modules/database/snapshot.js @@ -22,7 +22,6 @@ export default class Snapshot { this.ref = ref; this.key = snapshot.key; this.value = snapshot.value; - this.exists = snapshot.exists || true; this.priority = snapshot.priority === undefined ? null : snapshot.priority; this.childKeys = snapshot.childKeys || []; } From 9a43e11ddeda72060b8512afddf002b89260bbf3 Mon Sep 17 00:00:00 2001 From: Francisco Saldana Date: Sat, 7 Jan 2017 20:10:03 -0600 Subject: [PATCH 2/3] Readme --- docs/api/database.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/api/database.md b/docs/api/database.md index 54594f1..ef4a5c8 100644 --- a/docs/api/database.md +++ b/docs/api/database.md @@ -25,6 +25,14 @@ firestack.database() }); ``` +Test value exists at location: +```javascript +firestack.database() + .ref('posts/1234') + .exists(); +``` + + ## Unmounted components Listening to database updates on unmounted components will trigger a warning: From a6566f31d5091e202eac42c29075ac3cca8884a2 Mon Sep 17 00:00:00 2001 From: Francisco Saldana Date: Sat, 7 Jan 2017 20:13:01 -0600 Subject: [PATCH 3/3] Fix doc. --- docs/api/database.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/api/database.md b/docs/api/database.md index ef4a5c8..27c65d9 100644 --- a/docs/api/database.md +++ b/docs/api/database.md @@ -29,7 +29,9 @@ Test value exists at location: ```javascript firestack.database() .ref('posts/1234') - .exists(); + .on('value', (snapshot) => { + const exists = snapshot.exists(); + }); ```