• Stars
    star
    311
  • Rank 134,521 (Top 3 %)
  • Language
    TypeScript
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸš„ A CLI utility for moving data to and from Cloud Firestore

Fire Migrate

πŸ‘€ Firestore now has an official import/export process. Consider that your first option if it suits your needs. If it does not, continue reading...

CLI tool for moving data in-n-out of Cloud Firestore.

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

Watch the screencast

Install

  • Clone and run npm install
  • Download the service account from your Firebase project settings, then save it as credentials.json in the project root.
  • npm run build and you're off and running.

Import Data to Firestore

  • 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> [collections...]

Options:

-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)
                            
-s, --sheet [#]             Single mode XLSX Sheet # to import.
                            
-T, --truncate              Delete all documents from target collections before import.
                            
-d, --dry-run               Perform a dry run, without committing data. Implies --verbose.
-v, --verbose               Output document insert paths
-h, --help                  output usage information

Examples:

fire-migrate import --dry-run test.json myCollection
fire-migrate import --merge test.INDEX.csv myCollection
fire-migrate i -m --id docid test.xlsx myCollection

Export Data from Firestore

  • 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:


-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 --no-subcolls myCollectionRootLevel.json myCollection
fire-migrate export users-posts.json users posts
fire-migrate e -v firestore-dump.xlsx

More Repositories

1

sveltefire

Cybernetically enhanced Firebase apps
Svelte
955
star
2

angular-firestarter

🍱 πŸ”₯ Angular + Firebase Progressive Web App Starter
TypeScript
931
star
3

rektor-db

Rektor Vector Database
588
star
4

code-this-not-that-js

JavaScript Pro Tips - Code This, Not That
JavaScript
512
star
5

geofirex

🌐 πŸ“ Geolocation Queries with Firestore & RxJS
TypeScript
460
star
6

async-await-pro-tips

TypeScript
232
star
7

electron-forge-svelte

A starter template for Electron Forge + Svelte 3
JavaScript
132
star
8

gimmie-sticker

Trade a Pull Request for a Sticker
JavaScript
123
star
9

ngrx-vs-ngxs

A side-by-side comparison of Angular state management libraries
TypeScript
116
star
10

cloud-functions-master-course

Firebase Cloud Functions Master Course
HTML
113
star
11

ngrx-fire

Demo app using Angular + ngrx + Firebase
TypeScript
109
star
12

angular-gtag

πŸ”– Google Analytics gtag.js for Angular
TypeScript
108
star
13

angular-firebase-stripe

Full Stack Stripe Payments Solution with Angular + Firebase
TypeScript
88
star
14

ionic4-master-course

Source Code for the Ionic 4 Master Course
TypeScript
67
star
15

sveltefire-template

App template for SvelteFire
HTML
52
star
16

ionic-firestarter

Ionic Firebase Starter Template
TypeScript
44
star
17

stripe-firebase-master-course

44
star
18

hnpwa-angular5

Hacker News PWA with an Angular 5 Service Worker
HTML
42
star
19

vue-firestore-hello-world

Quickstart using Webpack, Vuefire, and Firestore
JavaScript
23
star
20

magic-music-flutter-create

Dart
19
star
21

can-i-use-ng-add

Where can I use the `ng add` command?
16
star
22

hippicons

an alternative icon font for the web
HTML
13
star
23

flowmap

Stream and slice data
Dart
13
star
24

javascript-jeopardy

A Realtime Trivia Game
HTML
12
star
25

lazy-loading-angular

A bare minimum demo for Component Lazy Loading in Angular 4
TypeScript
11
star
26

lex-chatbot-lambda

Python validation for Lex. AWS Chatbot Hackathon 2017
Python
10
star
27

self-driving-car-projects

Self Driving Car Projects
Jupyter Notebook
10
star
28

machine-learning-nanodegree

Machine learning projects and examples
HTML
10
star
29

tasksnail

Rails, AJAX, and Devise - Single Page Application Demo
CSS
9
star
30

hotroute

TypeScript
8
star
31

anchorage

Community Powered Cruising Guide for Boaters
JavaScript
7
star
32

lightstate

Experimental StatefulObject
TypeScript
5
star
33

firestarter-geofire

TypeScript
5
star
34

nice-tweets-only

Sentiment Validation with Ionic v4 + Cloud Language API + Cloud Functions
TypeScript
5
star
35

icon-font-lesson

codediode.io lesson for creating custom icon fonts
CSS
4
star
36

brachial-plexus-ultrasound-segmentation

Neural network comparison for Kaggle Ultrasound Segmentation competition
Jupyter Notebook
3
star
37

rembg-webapp-tutorial

a simple webapp with rembg
HTML
3
star
38

kaggle-scripts

Data visualization and machine learning scripts on Kaggle
Jupyter Notebook
3
star
39

juicesherpa

Build Juice Recipes with Realtime Nutrition Facts
Ruby
2
star
40

platform

A digital sandbox of Matthew harwood
TypeScript
2
star