Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@firebase/firestore

Package Overview
Dependencies
Maintainers
5
Versions
3571
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@firebase/firestore

The Cloud Firestore component of the Firebase JS SDK.

  • 1.18.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
721K
decreased by-62.54%
Maintainers
5
Weekly downloads
 
Created

What is @firebase/firestore?

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.

What are @firebase/firestore's main functionalities?

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());
    });
  });

Other packages similar to @firebase/firestore

FAQs

Package last updated on 15 Oct 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc