-
-
Save meDavid/1e87b444f79b7b04d451ebe5e2279e84 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let admin = require("firebase-admin"); | |
let cars = require('./cars.json'); | |
let serviceAccount = require("./serviceAccountKey.json"); | |
admin.initializeApp({ | |
"databaseURL": "https://fir-elasticsearch.firebaseio.com", | |
"credential": admin.credential.cert(serviceAccount), | |
}); | |
let carsRef = admin.database().ref('/cars'); | |
let carsImportLimit = 1000; | |
let pushPromises = []; | |
console.log('Importing ' + carsImportLimit + 'cars'); | |
for(let i =0; i < carsImportLimit; i++ ) { | |
pushPromises.push(cars[i]); | |
} | |
Promise.all(pushPromises).then(() => { | |
console.log('done!'); | |
process.exit(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment