When I try to initialize Firebase Cloud Firestore, I ran into the following error:
Uncaught TypeError: WEBPACK_IMPORTED_MODULE_0_firebase
During plugin installation you'll be asked whether or not you use Firestore.
In case you're upgrading and you have the firebase.nativescript.json file in your project root, edit it and add: "firestore": true. Then run rm -rf platforms && rm -rf node_modules && npm i.
By default Firestore on iOS and Android persists data locally for offline usage (web doesn't by default, and the regular Firebase DB doesn't either on any platform). If you don't like that awesome feature, you can pass persist: false to the init function.
Note that initializeApp is simply an alias for init to make the plugin compatible with the web API.
const firebase = require("nativescript-plugin-firebase/app");
firebase.initializeApp({
persist: false
});
A 'collection' is at the root of any Firestore interaction. Data is stored as a 'document' inside a collection.
const citiesCollection = firebase.firestore().collection("cities");
Source: nativescript-plugin-firebase