Skip to content
Node.js client for Google Cloud Firestore: a NoSQL document database built for automatic scaling, high performance, and ease of application development.
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github chore: move CONTRIBUTING.md to root (#543) Feb 7, 2019
.idea/runConfigurations Add IntelliJ test runners (#663) May 28, 2019
.kokoro build: switch to GitHub magic proxy, for release-please (#694) Jun 19, 2019
dev Tests: Fix flaky system test (#716) Jul 17, 2019
samples chore: release 2.2.4 (#714) Jul 8, 2019
types feat: Support host, ssl and FIRESTORE_EMULATOR_HOST for endpoint conf… Jun 5, 2019
.eslintignore chore: update nyc and eslint configs (#491) Dec 11, 2018
.eslintrc.yml Enable prefer-const in the eslint config (#353) Sep 20, 2018
.gitignore docs: add .readme-metadata.json and generate new README.md (#595) Apr 2, 2019
.jsdoc.js fix(docs): link to reference docs section on googleapis.dev (#701) Jun 25, 2019
.nycrc build: ignore proto files in test coverage (#664) May 28, 2019
.prettierignore chore(build): update the prettier config (#476) Dec 5, 2018
.prettierrc chore(build): update the prettier config (#476) Dec 5, 2018
.readme-partials.yaml docs: add .readme-metadata.json and generate new README.md (#595) Apr 2, 2019
.repo-metadata.json fix(docs): move to new client docs URL (#689) Jun 13, 2019
CHANGELOG.md chore: release 2.2.4 (#714) Jul 8, 2019
CODE_OF_CONDUCT.md Initial release of @google-cloud/firestore. Oct 3, 2017
CONTRIBUTING.md docs: update links in contrib guide (#550) Feb 14, 2019
LICENSE chore: update license file (#473) Dec 4, 2018
README.md fix(docs): link to reference docs section on googleapis.dev (#701) Jun 25, 2019
codecov.yaml Update kokoro config and use const (#371) Oct 2, 2018
linkinator.config.json build: use config file for linkinator (#704) Jun 28, 2019
package.json chore: release 2.2.4 (#714) Jul 8, 2019
renovate.json chore: ignore package-lock.json (#312) Aug 7, 2018
synth.metadata build: switch to GitHub magic proxy, for release-please (#694) Jun 19, 2019
synth.py chore: Include v1beta1 in synth.py (#650) May 22, 2019
tsconfig.json refactor(typescript): enable noImplicitAny (#553) Feb 25, 2019
tslint.json Finish TypeScript Migration (#512) Feb 22, 2019

README.md

Google Cloud Platform logo

Cloud Firestore: Node.js Client

release level npm version codecov

This is the Node.js Server SDK for Google Cloud Firestore. Google Cloud Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.

This Cloud Firestore Server SDK uses Google’s Cloud Identity and Access Management for authentication and should only be used in trusted environments. Your Cloud Identity credentials allow you bypass all access restrictions and provide read and write access to all data in your Cloud Firestore project.

The Cloud Firestore Server SDKs are designed to manage the full set of data in your Cloud Firestore project and work best with reliable network connectivity. Data operations performed via these SDKs directly access the Cloud Firestore backend and all document reads and writes are optimized for high throughput.

Applications that use Google's Server SDKs should not be used in end-user environments, such as on phones or on publicly hosted websites. If you are developing a Web or Node.js application that accesses Cloud Firestore on behalf of end users, use the firebase Client SDK.

Note: This Cloud Firestore Server SDK does not support Firestore databases created in Datastore mode. To access these databases, use the Datastore SDK.

Read more about the client libraries for Cloud APIs, including the older Google APIs Client Libraries, in Client Libraries Explained.

Table of contents:

Quickstart

Before you begin

  1. Select or create a Cloud Platform project.
  2. Enable the Cloud Firestore API.
  3. Set up authentication with a service account so you can access the API from your local workstation.

Installing the client library

npm install @google-cloud/firestore

Using the client library

const {Firestore} = require('@google-cloud/firestore');

// Create a new client
const firestore = new Firestore();

async function quickstart() {
  // Obtain a document reference.
  const document = firestore.doc('posts/intro-to-firestore');

  // Enter new data into the document.
  await document.set({
    title: 'Welcome to Firestore',
    body: 'Hello World',
  });
  console.log('Entered new data into the document');

  // Update an existing document.
  await document.update({
    body: 'My first Firestore app',
  });
  console.log('Updated an existing document');

  // Read the document.
  let doc = await document.get();
  console.log('Read the document');

  // Delete the document.
  await document.delete();
  console.log('Deleted the document');
}
quickstart();

Samples

Samples are in the samples/ directory. The samples' README.md has instructions for running the samples.

Sample Source Code Try it
Quickstart source code Open in Cloud Shell

The Cloud Firestore Node.js Client API Reference documentation also contains samples.

Versioning

This library follows Semantic Versioning.

This library is considered to be General Availability (GA). This means it is stable; the code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against GA libraries are addressed with the highest priority.

More Information: Google Cloud Platform Launch Stages

Contributing

Contributions welcome! See the Contributing Guide.

License

Apache Version 2.0

See LICENSE

You can’t perform that action at this time.