[docs] misc tweaks to docs

This commit is contained in:
Salakar 2017-10-04 21:18:20 +01:00
parent dd0051b42d
commit c00c132927
3 changed files with 26 additions and 3 deletions

View File

@ -2,7 +2,7 @@
### Enable Database Persistence ### Enable Database Persistence
Enabling database persistence (setPersistence) via JS for the default is no longer supported. This breaking change was added in v3 to prevent several race condition issues. Enabling database persistence (setPersistence) via JS for the default app is no longer supported. This breaking change was added in v3 to prevent several race condition issues around.
You can still however easily enable this natively for the default app instance: You can still however easily enable this natively for the default app instance:

View File

@ -1,5 +1,8 @@
<!-- TODO --> <!-- TODO -->
### Log Options ### Log Options
TODO - PR's welcome
### Debug Options ### Debug Options
TODO - PR's welcome

View File

@ -4,9 +4,9 @@
RNFirebase mimics the [Firestore Web SDK](https://firebase.google.com/docs/reference/js/firebase.firestore), whilst RNFirebase mimics the [Firestore Web SDK](https://firebase.google.com/docs/reference/js/firebase.firestore), whilst
providing support for devices in low/no data connection state. providing support for devices in low/no data connection state.
All Firestore operations are accessed via `firestore()`. All Firestore operations are accessed via `firestore()`. For detailed documentation of the supported methods demonstrated below please use the official firestore web sdk guides.
Please note that Persistence (offline support) is enabled by default with Firestore on iOS and Android. ?> Please note that Persistence (offline support) is enabled by default with Firestore on iOS and Android.
## Add and Manage Data ## Add and Manage Data
@ -14,6 +14,8 @@ Please note that Persistence (offline support) is enabled by default with Firest
Read information about a collection example: Read information about a collection example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.collection('posts') .collection('posts')
.get() .get()
@ -31,6 +33,8 @@ firebase.firestore()
Add to a collection example (generated ID): Add to a collection example (generated ID):
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.collection('posts') .collection('posts')
.add({ .add({
@ -44,6 +48,8 @@ firebase.firestore()
Add to a collection example (manual ID): Add to a collection example (manual ID):
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.collection('posts') .collection('posts')
.doc('post1') .doc('post1')
@ -60,6 +66,8 @@ firebase.firestore()
There are multiple ways to read a document. The following are equivalent examples: There are multiple ways to read a document. The following are equivalent examples:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.doc('posts/posts1') .doc('posts/posts1')
.get((documentSnapshot) => { .get((documentSnapshot) => {
@ -76,6 +84,8 @@ firebase.firestore()
Create a document example: Create a document example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.doc('posts/posts1') .doc('posts/posts1')
.set({ .set({
@ -89,6 +99,8 @@ firebase.firestore()
Updating a document example: Updating a document example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.doc('posts/posts1') .doc('posts/posts1')
.update({ .update({
@ -101,6 +113,8 @@ firebase.firestore()
Deleting a document example: Deleting a document example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.doc('posts/posts1') .doc('posts/posts1')
.delete() .delete()
@ -114,6 +128,8 @@ firebase.firestore()
Writes, updates and deletes to documents can be batched and committed atomically as follows: Writes, updates and deletes to documents can be batched and committed atomically as follows:
```javascript ```javascript
import firebase from 'react-native-firebase';
const ayRef = firebase.firestore().doc('places/AY'); const ayRef = firebase.firestore().doc('places/AY');
const lRef = firebase.firestore().doc('places/LON'); const lRef = firebase.firestore().doc('places/LON');
const nycRef = firebase.firestore().doc('places/NYC'); const nycRef = firebase.firestore().doc('places/NYC');
@ -145,6 +161,8 @@ Coming soon
Listen to collection updates example: Listen to collection updates example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.collection('cities') .collection('cities')
.where('state', '==', 'CA') .where('state', '==', 'CA')
@ -161,6 +179,8 @@ The snapshot handler will receive a new query snapshot every time the query resu
Listen to document updates example: Listen to document updates example:
```javascript ```javascript
import firebase from 'react-native-firebase';
firebase.firestore() firebase.firestore()
.doc('posts/post1') .doc('posts/post1')
.onSnapshot((documentSnapshot) => { .onSnapshot((documentSnapshot) => {