Instantly share code, notes, and snippets.

Embed
What would you like to do?
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