Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

Namespace: firestore

rules.firestore

namespace   static

Context specific variables and methods for Cloud Firestore security rules.

Functions in this namespace are only available insideservice cloud.firestore { ... } blocks and do not need to be prefixed when used (get() notfirestore.get()).

Interfaces

Properties

request

static

non-nullrules.firestore.Request

The request context, including authentication information and pending data.

resource

static

non-nullrules.firestore.Resource

The resource being read or written.

Methods

exists

static

exists(path) returns rules.Boolean

Check if a document exists.

Parameter

path

rules.Path

The path.

Value must not be null.

Returns

non-nullrules.Boolean true if the resource exists.

Example

// Check if another document existsallowwrite:ifexists(/databases/$(database)/documents/things/other)

existsAfter

static

existsAfter(path) returns rules.Boolean

Check if a document exists, assuming the current request succeeds. Equivalent to getAfter(path) != null.

Parameter

path

rules.Path

The path.

Value must not be null.

Returns

non-nullrules.Boolean true if the resource exists.

get

static

get(path) returns rules.firestore.Resource

Get the contents of a firestore document.

Parameter

path

rules.Path

The path.

Value must not be null.

Returns

non-nullrules.firestore.Resource the document, or null if it does not exist.

Example

// Get the 'thing1' document from the 'things' collectionget(/databases/$(database)/documents/things/thing1)

getAfter

static

getAfter(path) returns rules.firestore.Resource

Get the projected contents of a document. The document is returned as if the current request had succeeded. Useful for validating documents that are part of a batched write or transaction.

Parameter

path

rules.Path

The path.

Value must not be null.

Returns

non-nullrules.firestore.Resource the document, or null if it does not exist.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2019-12-13 UTC.


[8]ページ先頭

©2009-2026 Movatter.jp