Reputation: 2013
I'm already using Firebase Realtime database, but now Firebase has launched Cloud Firestore for database so, how can I transfer my data from realtime database to firestore as I already have users and they are using realtime database on the android app.
So, is there a way that I can transfer the database to firestore?
Upvotes: 4
Views: 3037
Reputation: 138824
If you're looking for a magic button that can convert your database from the Realtime Database
to Cloud Firestore
, there isn't one! And as far as I read, Firebase creators won't create one. So unfortunately, you'll need to convert the database yourself.
Upvotes: 2
Reputation: 75
i made a script for converting data from firebase to firestore
import { AngularFirestore, AngularFirestoreCollection } from 'angularfire2/firestore';
import { AngularFireDatabase } from 'angularfire2/database';
constructor(
private afs: AngularFirestore,
private angularfire: AngularFireDatabase
) { }convert() {
this.itemsCollection = this.afs.collection('requests'); //ref()
this.angularfire.list('/requests/').auditTrail().subscribe((data: any) => {
_.each(data, element => {
this.itemsCollection.doc(element.key).set(element.payload.val())
.then((result) => {
});
});
});}
Upvotes: 0
Reputation: 892
I don't recommend you changing now, its is still in its BETA version and they are coming up with new things every now and then. I suggest to wait. Let them make up their mind first :P
Upvotes: 0
Reputation: 20654
Firebase has published a guide for migrating from Realtime Database to Cloud Firestore.
Edit: It seems they have changed that page. Here is a cached version of their migration guide published earlier.
Upvotes: 2