Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@firebase/firestore
Advanced tools
The Cloud Firestore component of the Firebase JS SDK.
The @firebase/firestore package is a part of the Firebase JavaScript SDK, providing a powerful, scalable database for mobile, web, and server development. It offers real-time synchronization, offline support, and efficient data querying capabilities. This package allows developers to interact with Firestore, a NoSQL cloud database to store and sync data for client- and server-side development.
Adding Data
This feature allows you to add new documents to your Firestore database. The code sample demonstrates adding a new user with name and age fields to a 'users' collection.
db.collection('users').add({
name: 'Ada Lovelace',
age: 36
});
Reading Data
This feature enables reading documents from your Firestore database. The code sample shows how to fetch a document by its ID from the 'users' collection and log its data.
db.collection('users').doc('userId').get().then((doc) => {
if (doc.exists) {
console.log('Document data:', doc.data());
} else {
console.log('No such document!');
}
});
Listening for Real-time Updates
This feature provides real-time updates on data changes. The code sample demonstrates setting up a listener on a user document to log updates in real-time.
db.collection('users').doc('userId')
.onSnapshot((doc) => {
console.log('Current data: ', doc.data());
});
Querying Data
This feature allows querying documents based on certain conditions. The code sample shows how to query all users older than 18 years and log their data.
db.collection('users').where('age', '>', 18)
.get()
.then((querySnapshot) => {
querySnapshot.forEach((doc) => {
console.log(doc.id, ' => ', doc.data());
});
});
Mongoose is an ODM (Object Data Modeling) library for MongoDB and Node.js. It manages relationships between data, provides schema validation, and is used to translate between objects in code and the representation of those objects in MongoDB. Compared to @firebase/firestore, Mongoose is specific to MongoDB and does not offer real-time data synchronization.
Sequelize is a promise-based Node.js ORM for Postgres, MySQL, MariaDB, SQLite, and Microsoft SQL Server. It features solid transaction support, relations, eager and lazy loading, read replication, and more. Unlike @firebase/firestore, Sequelize is focused on SQL databases and does not provide real-time data updates or offline support.
PouchDB is an open-source JavaScript database that allows you to store data locally while offline, then synchronize it with CouchDB and compatible servers when the application is back online, keeping the user's data in sync no matter where they next login. While it offers offline data storage and sync capabilities similar to Firestore, it is more suited for applications that require data to be stored locally on the user's device.
This is the Cloud Firestore component of the Firebase JS SDK.
This package is not intended for direct usage, and should only be used via the officially supported firebase package.
If you are developing a Node.js application that requires administrative access to Cloud Firestore,
use the @google-cloud/firestore
Server
SDK with your developer credentials.
For comprehensive documentation please see the Firebase Reference Docs.
See Contributing to the Firebase SDK for general information about contributing to the firebase-js-sdk repo and Contributing to the Cloud Firestore Component for details specific to the Cloud Firestore code and tests.
FAQs
The Cloud Firestore component of the Firebase JS SDK.
We found that @firebase/firestore demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.