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-compat
Advanced tools
The @firebase/firestore-compat package is designed to provide compatibility with older versions of Firebase Firestore for projects that use the Firebase JavaScript SDK. It allows developers to use the new Firestore SDK in a way that is compatible with the older syntax and methods, facilitating easier upgrades and maintenance of legacy code.
Data Retrieval
This feature allows you to retrieve data from a Firestore database. The code sample demonstrates how to fetch a document from the 'users' collection using a specific user ID.
const db = firebase.firestore();
const docRef = db.collection('users').doc('user_id');
docRef.get().then((doc) => {
if (doc.exists) {
console.log('Document data:', doc.data());
} else {
console.log('No such document!');
}
}).catch((error) => {
console.log('Error getting document:', error);
});
Data Modification
This feature covers adding or updating data in Firestore. The code sample shows how to set data for a document in the 'users' collection, effectively creating or updating a document.
const db = firebase.firestore();
db.collection('users').doc('user_id').set({
firstName: 'John',
lastName: 'Doe'
}).then(() => {
console.log('Document successfully written!');
}).catch((error) => {
console.error('Error writing document: ', error);
});
Real-time Updates
This feature enables listening to real-time updates of a document in Firestore. The code sample illustrates how to subscribe to changes in a document, receiving updates automatically whenever the document data changes.
const db = firebase.firestore();
const docRef = db.collection('users').doc('user_id');
docRef.onSnapshot((doc) => {
if (doc.exists) {
console.log('Current data: ', doc.data());
} else {
console.log('No such document!');
}
});
This is the modern version of Firebase Firestore SDK for JavaScript. It offers a more modular and tree-shakable design compared to @firebase/firestore-compat. While @firebase/firestore-compat is meant for compatibility with older codebases, @firebase/firestore provides improved performance and smaller bundle sizes in new applications.
PouchDB is an open-source JavaScript database that allows you to store data locally while offline before syncing it with a compatible server such as CouchDB when online. It differs from @firebase/firestore-compat as it is not tied to Firebase's ecosystem and focuses more on offline-first capabilities.
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.
The npm package @firebase/firestore-compat receives a total of 1,413,895 weekly downloads. As such, @firebase/firestore-compat popularity was classified as popular.
We found that @firebase/firestore-compat 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.