Skip to content

Commit

Permalink
Merge d4ed971 into 2b95d76
Browse files Browse the repository at this point in the history
  • Loading branch information
spoxies committed Dec 6, 2018
2 parents 2b95d76 + d4ed971 commit b3096e1
Show file tree
Hide file tree
Showing 14 changed files with 1,823 additions and 1,050 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,18 @@
#### 2.2.3 (2018-11-15)

##### Chores

* **README:** update badges ([dfc9f1ba](https://github.com/MichaelSolati/geofirestore/commit/dfc9f1ba4f55cc054c161e2561fb2000fb649725))
* update firebase settings and dependencies ([2b95d766](https://github.com/MichaelSolati/geofirestore/commit/2b95d766bd7fb5fa92ba0b7ada859468cca62999))
* update `README.md` ([d55b979a](https://github.com/MichaelSolati/geofirestore/commit/d55b979ac8d8d07a7d3b3b67ee85f44915a39d66))
* rename `COMMITS.md` to `CONTRIBUTING.md` ([f37e95ee](https://github.com/MichaelSolati/geofirestore/commit/f37e95ee305fe3e0f82c5b290f04caa8fba513c8))
* **LICENSE:** update license ([7dc3064e](https://github.com/MichaelSolati/geofirestore/commit/7dc3064e674497334d0b2a47f767b1aefafcd59c))
* **COC:** add a Code of Conduct ([e018ddba](https://github.com/MichaelSolati/geofirestore/commit/e018ddba42a5476669a7536d6ede378c8f508a1a))

##### Bug Fixes

* **lint:** resolve linting issues in some firebase projects, fixes [#48](https://github.com/MichaelSolati/geofirestore/pull/48) ([a9fe161a](https://github.com/MichaelSolati/geofirestore/commit/a9fe161a377425d18806f0f470c22f8d46a7666a))

#### 2.2.2 (2018-10-10)

##### Documentation Changes
Expand Down
50 changes: 49 additions & 1 deletion README.md
@@ -1,6 +1,6 @@
# geofirestore

[![npm version](https://badge.fury.io/js/geofirestore.svg)](https://badge.fury.io/js/geofirestore) [![Build Status](https://travis-ci.org/MichaelSolati/geofirestore.svg?branch=master)](https://travis-ci.org/MichaelSolati/geofirestore) [![Coverage Status](https://coveralls.io/repos/github/MichaelSolati/geofirestore/badge.svg?branch=master)](https://coveralls.io/github/MichaelSolati/geofirestore?branch=master)
[![npm version](https://badge.fury.io/js/geofirestore.svg)](https://badge.fury.io/js/geofirestore) [![Build Status](https://travis-ci.org/geofirestore/geofirestore-js.svg?branch=master)](https://travis-ci.org/geofirestore/geofirestore-js) [![Coverage Status](https://coveralls.io/repos/github/geofirestore/geofirestore-js/badge.svg?branch=master)](https://coveralls.io/github/geofirestore/geofirestore-js?branch=master)

GeoFirestore is an open-source library that allows you to store and query a set of keys based on their geographic location. At its heart, GeoFirestore simply stores locations with string keys. Its main benefit, however, is the possibility of retrieving only those keys within a given geographic area - all in realtime.

Expand Down Expand Up @@ -45,6 +45,7 @@ You can find a full list of our demos and view the code for each of them in the
* [`get(key)`](#geofirestoregetkey)
* [`add(document[, customKey])`](#geofirestoreadddocument-customkey)
* [`set(keyOrDocuments[, document, customKey])`](#geofirestoresetkeyordocuments-document-customkey)
* [`update(keyOrDocuments[, document, customKey])`](#geofirestoreupdateexistingkeyordocuments-document-customkey)
* [`remove(key)`](#geofirestoreremovekey)
* [`query(queryCriteria)`](#geofirestorequeryquerycriteria)
* [`GeoFirestoreQuery`](#geofirestorequery)
Expand Down Expand Up @@ -157,6 +158,53 @@ geoFirestore.set({
});
```

#### GeoFirestore.update(existingKeyOrDocuments[, document, customKey])

Updates the specified key - document pair(s) in this `GeoFirestore`. If the provided `keyOrDocuments` argument is a string than a single `document` will be updated. The `keyOrDocuments` argument can also an object containing a mapping between keys and documents. Thus allowing you to add several documents to GeoFirestore in one write.

Additional attributes can be updated or added to the `keyOrDocuments`. If any of the attributes pre-exist in the `document` -and are not (re)defined within the `keyOrDocuments` argument-, then those attributes will remain (unchanged). If merging of existing `document` data is not required, then [`GeoFirestore.set([..])`](#geofirestoresetkeyordocuments-document-customkey) is the more efficient choice.

This method returns a promise which is fulfilled when the new document has been synchronized with the Firebase servers. If the provided key(s) do not exist in `GeoFirestore`, the update will fail and the returned Promise will be rejected. If the document has a `coordinates` field to update, then it must be a valid Firestore GeoPoint.

```JavaScript
geoFirestore.update('existing_key', {
coordinates: new firebase.firestore.GeoPoint(37.79, -122.41),
some_custom_key: 'text' // Add|update a custom key
}).then(() => {
console.log('Document has been updated in GeoFirestore');
}, (error) => {
console.log('Error: ' + error);
});
```

```JavaScript
geoFirestore.update('existing_key', {
// Update coordinates only
coordinates: new firebase.firestore.GeoPoint(52.09, -5.12)
}).then(() => {
console.log('Document has been updated in GeoFirestore');
}, (error) => {
console.log('Error: ' + error);
});
```

```JavaScript
geoFirestore.update({
// Update multiple documents (with && witout coordinates)
'existing_key': {
custom_key: 'new text'
},
'another_existing_key': {
coordinates: new firebase.firestore.GeoPoint(36.98, -122.56),
other_key: 'text'
}
}).then(() => {
console.log('Provided documents have been updated in GeoFirestore');
}, (error) => {
console.log('Error: ' + error);
});
```

#### GeoFirestore.remove(key)

Removes the provided `key` from this `GeoFirestore`. Returns a promise fulfilled when the removal of `key` has been synchronized with the Firebase servers. If the provided `key` is not present in this `GeoFirestore`, the promise will still successfully resolve.
Expand Down

0 comments on commit b3096e1

Please sign in to comment.