[]
        
(Showing Draft Content)

Firestore Class

Firestore Class

Represents a Firestore database with one or more collections.

Each collection is represented by a Collection object that exposes the data on the collection as a CollectionView object which can be used as a data source for any Wijmo control.

In addition to full CRUD support you get all the CollectionView features including sorting, filtering, paging, and grouping.

The sorting, filtering, and paging functions may be performed on the server or on the client, depending on the setting of the Collection.sortOnServer, Collection.filterOnServer, and Collection.pageOnServer properties.

The code below shows how you can instantiate a Firestore object that loads data from three collections:

import { Firestore } from '@grapecity/wijmo.cloud';
const PROJECT_ID = 'XXXX-YYYY';
const API_KEY = 'ZZZZ';
let fsNWind = new Firestore(PROJECT_ID, API_KEY, {
    collections: [ 'Products', 'Categories', 'Suppliers' ]
});

This class does not use or require the use of the Firestore client libraries.

Heirarchy

  • Firestore

Constructors

constructor

  • new Firestore(projectId: string, apiKey: string, options?: any): Firestore
  • Initializes a new instance of the Firestore class.

    Parameters

    • projectId: string

      ID of the Firebase app that contains the database.

    • apiKey: string

      Unique identifier used to authenticate requests associated with the app. To generate API keys, please go to https://console.cloud.google.com/.

    • Optional options: any

      JavaScript object containing initialization data (property values and event handlers) for this Firestore.

    Returns Firestore

Properties

accessToken

accessToken: string | null

Gets or sets an OAuth 2.0 access token used to access the database.

You can use the OAuth2 class to allow users to log in and to obtain the accessToken string.

If you choose this authentication method, Firestore Security Rules will not be applied. Firestore will use Cloud Identity and Access Management (IAM) instead.

See also the idToken property, which does integrate with Firestore Security Rules.

apiKey

apiKey: string

Gets the API key used to create this Firestore.

collections

Gets the list of Collection objects in this Firestore.

idToken

idToken: string | null

Gets or sets a OAuth 2.0 id token used to access the database.

You can use the OAuth2 class to allow users to log in and to obtain the idToken string.

If you choose this authentication method, Firestore Security Rules will be applied as usual to determine which users can read and write to the database.

See also the accessToken property, which bypasses Firestore Security Rules and uses Cloud Identity and Access Management (IAM) instead.

projectId

projectId: string

Gets the ID of the Firebase app that contains the database.

Methods

getCollection

onAccessTokenChanged

Events

accessTokenChanged

accessTokenChanged: Event<Firestore, EventArgs>

Occurs when the value of the accessToken property changes.