Skip to content

Commit

Permalink
Merge pull request #12 from stildalf/master
Browse files Browse the repository at this point in the history
Pull request for Issue #10 and Feature #11
  • Loading branch information
codediodeio authored Sep 15, 2018
2 parents 5090935 + a7095ca commit 53f4fa9
Show file tree
Hide file tree
Showing 23 changed files with 1,792 additions and 1,689 deletions.
39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

CLI tool for moving data in-n-out of [Cloud Firestore](https://firebase.google.com/docs/firestore/).

- Import a CSV, Excel, or JSON file to Firestore
- Export Firestore data to JSON
- Import/Export CSV, Excel, or JSON files to/from Firestore.
- Encode/Decode Firestore data types such as GeoPoint, Reference, Timestamp, etc.

Watch the [screencast](https://angularfirebase.com/lessons/import-csv-json-or-excel-to-firestore/)

Expand All @@ -15,23 +15,22 @@ Watch the [screencast](https://angularfirebase.com/lessons/import-csv-json-or-ex

## Import Data to Firestore

Push your local data to the Firestore database.
- Push your local data to the Firestore database.
- Selectively import [collections...] from source file to Firestore.
- Omitting [collections...], or specifying root "/" will import all collections.

```
import|i [options] <file> <collection>
import|i [options] <file> [collections...]
```

Options:
```
-i, --id [field] Field to use for document ID
-m, --merge Merge Firestore documents. Default is replace.
-i, --id [field] Field to use for Document IDs (default: doc_id)
-a, --auto-id [str] Document ID token specifying auto generated Document ID (default: Auto-ID)
-m, --merge Merge Firestore documents. Default is Replace.
-k, --chunk [size] Split upload into batches. Max 500 by Firestore constraints. (default: 500)
-p, --coll-prefix [prefix] (Sub-)Collection prefix (default: collection)
-c, --col-oriented XLSX column orientation. Default is row orientation
-o, --omit-empty-fields XLSX omit empty fields
-s, --sheet [#] XLSX Sheet # to import (default: 1)
-d, --dry-run Perform a dry run, without committing data. Implies --verbose.
-v, --verbose Output document insert paths
-h, --help output usage information
Expand All @@ -40,29 +39,37 @@ Options:
Examples:
```
fire-migrate import --dry-run test.json myCollection
fire-migrate import --merge test.csv myCollection
fire-migrate i -m --id docid --sheet 3 test.xlsx myCollection
fire-migrate import --merge test.INDEX.csv myCollection
fire-migrate i -m --id myDocIdField test.xlsx users posts
fire-migrate i -v firestore-dump.json
```

## Export Data from Firestore

Pull data from Firestore to a JSON file.
- Pull data from Firestore to a JSON, CSV or XLSX file.
- Selectively export [collections...], or entire database with root "/".
- Exports Sub-Collections by default, optionally disabled.
- Splits CSV/XLSX collections into separate files/sheets with an INDEX.

```
export|e [options] <file> [collections...]
```

Options:
```
-s, --subcolls Include sub-collections.
-n, --no-subcolls Do not export sub-collections.
-p, --coll-prefix [prefix] Collection prefix (default: collection)
-i, --id-field [id] Field name to use for document IDs (default: doc_id)
-v, --verbose Output traversed document paths
-h, --help output usage information
```

Examples:
```
fire-migrate export --verbose --subcolls myCollection.json myCollection
fire-migrate export --verbose --no-subcolls myRootCollection.json myCollection
fire-migrate export users-posts.json users posts
fire-migrate e -sv firestore-dump.json
fire-migrate export path/to/indexed-csv/db.csv
fire-migrate e -v firestore-dump.json
```
Loading

0 comments on commit 53f4fa9

Please sign in to comment.