firebase-admin.firestore package

外部 API 重新导出

为方便起见,系统将从此模块入口点重新导出以下外部定义的 API。

符号 说明
BulkWriter 来自 @google-cloud/firestore 软件包的 BulkWriter 类型。
AggregateField 来自 @google-cloud/firestore 软件包的 AggregateField 类型。
BulkWriterOptions 来自 @google-cloud/firestore 软件包的 BulkWriterOptions 类型。
BundleBuilder 来自 @google-cloud/firestore 软件包的 BundleBuilder 类型。
集合组 来自 @google-cloud/firestore 软件包的 CollectionGroup 类型。
CollectionReference 来自 @google-cloud/firestore 软件包的 CollectionReference 类型。
文档更改 来自 @google-cloud/firestore 软件包的 DocumentChange 类型。
DocumentData 来自 @google-cloud/firestore 软件包的 DocumentData 类型。
DocumentReference 来自 @google-cloud/firestore 软件包的 DocumentReference 类型。
DocumentSnapshot 来自 @google-cloud/firestore 软件包的 DocumentSnapshot 类型。
FieldPath 来自 @google-cloud/firestore 软件包的 FieldPath 类型。
FieldValue 来自 @google-cloud/firestore 软件包的 FieldValue 类型。
过滤 来自 @google-cloud/firestore 软件包的 Filter 类型。
Firestore 来自 @google-cloud/firestore 软件包的 Firestore 类型。
FirestoreDataConverter 来自 @google-cloud/firestore 软件包的 FirestoreDataConverter 类型。
GeoPoint 来自 @google-cloud/firestore 软件包的 GeoPoint 类型。
GrpcStatus 来自 @google-cloud/firestore 软件包的 GrpcStatus 类型。
前提条件 来自 @google-cloud/firestore 软件包的 Precondition 类型。
查询 来自 @google-cloud/firestore 软件包的 Query 类型。
QueryDocumentSnapshot 来自 @google-cloud/firestore 软件包的 QueryDocumentSnapshot 类型。
QueryPartition 来自 @google-cloud/firestore 软件包的 QueryPartition 类型。
QuerySnapshot 来自 @google-cloud/firestore 软件包的 QuerySnapshot 类型。
ReadOptions 来自 @google-cloud/firestore 软件包的 ReadOptions 类型。
SetOptions 来自 @google-cloud/firestore 软件包的 SetOptions 类型。
时间戳 来自 @google-cloud/firestore 软件包的 Timestamp 类型。
事务 来自 @google-cloud/firestore 软件包的 Transaction 类型。
WriteBatch 来自 @google-cloud/firestore 软件包的 WriteBatch 类型。
WriteResult 来自 @google-cloud/firestore 软件包的 WriteResult 类型。
setLogFunction @google-cloud/firestore 软件包中的 setLogFunction 函数。

Cloud Firestore。

函数

函数 说明
getFirestore() 获取默认应用的默认 Firestore 服务。
getFirestore(应用) 获取指定应用的默认 Firestore 服务。
getFirestore(databaseId) (Beta 版)获取默认应用的指定 Firestore 服务。
getFirestore(app, databaseId) (Beta 版)获取指定应用的指定 Firestore 服务。
初始化 Firestore(应用、设置) 获取指定应用的默认 Firestore 服务,并将额外的参数传递给其构造函数。
initializeFirestore(app, settings, databaseId) (Beta 版)获取指定应用的指定 Firestore 服务,并将额外的参数传递给其构造函数。

接口

接口 说明
FirestoreSettings 要传递给 Firestore 构造函数的设置。

getFirestore()

获取默认应用的默认 Firestore 服务。

签名

export declare function getFirestore(): Firestore;

返回

Firestore

默认应用的默认 Firestore 服务。

示例

// Get the default Firestore service for the default app
const defaultFirestore = getFirestore();

getFirestore(应用)

获取指定应用的默认 Firestore 服务。

签名

export declare function getFirestore(app: App): Firestore;

参数

参数 类型 说明
app 应用 要返回的 Firestore 服务。

返回

Firestore

与提供的应用关联的默认 Firestore 服务。

示例

// Get the default Firestore service for a specific app
const otherFirestore = getFirestore(app);

getFirestore(databaseId)

此 API 作为面向开发者的预览版提供,可能会根据我们收到的反馈而发生变化。请勿在生产环境中使用此 API。

获取默认应用的已命名 Firestore 服务。

签名

export declare function getFirestore(databaseId: string): Firestore;

参数

参数 类型 说明
数据库 ID string 要返回的数据库的名称。

返回

Firestore

默认应用的指定 Firestore 服务。

示例

// Get the Firestore service for a named database and default app
const otherFirestore = getFirestore('otherDb');

getFirestore(app, databaseId)

此 API 作为面向开发者的预览版提供,可能会根据我们收到的反馈而发生变化。请勿在生产环境中使用此 API。

获取指定应用的已命名 Firestore 服务。

签名

export declare function getFirestore(app: App, databaseId: string): Firestore;

参数

参数 类型 说明
app 应用 要返回的 Firestore 服务。
数据库 ID string 要返回的数据库的名称。

返回

Firestore

与提供的应用关联的已命名 Firestore 服务。

示例

// Get the Firestore service for a named database and specific app.
const otherFirestore = getFirestore('otherDb');

初始化 Firestore(应用、设置)

获取指定应用的默认 Firestore 服务,并将额外的参数传递给其构造函数。

签名

export declare function initializeFirestore(app: App, settings?: FirestoreSettings): Firestore;

参数

参数 类型 说明
app 应用 要返回的 Firestore 服务。
设置 FirestoreSettings 要传递给构造函数的 Settings 对象。

返回

Firestore

与提供的应用和设置相关联的默认 Firestore 服务。

示例

// Get the Firestore service for a specific app, require HTTP/1.1 REST transport
const otherFirestore = initializeFirestore(app, {preferRest: true});

初始化 Firestore(app, settings, databaseId)

此 API 作为面向开发者的预览版提供,可能会根据我们收到的反馈而发生变化。请勿在生产环境中使用此 API。

获取给定应用的已命名 Firestore 服务,并将额外的参数传递给其构造函数。

签名

export declare function initializeFirestore(app: App, settings: FirestoreSettings, databaseId: string): Firestore;

参数

参数 类型 说明
app 应用 要返回的 Firestore 服务。
设置 FirestoreSettings 要传递给构造函数的 Settings 对象。
数据库 ID string 要返回的数据库的名称。

返回

Firestore

与提供的应用和设置关联的已命名 Firestore 服务。

示例

// Get the Firestore service for a specific app, require HTTP/1.1 REST transport
const otherFirestore = initializeFirestore(app, {preferRest: true}, 'otherDb');