유형 함수
| 이름 | 설명 |
TYPE
|
값의 유형을 STRING으로 반환합니다.
|
IS_TYPE
|
값이 지정된 유형과 일치하면 true를 반환합니다.
|
TYPE
구문:
type(input: ANY) -> STRING
설명:
input 유형의 문자열 표현을 반환합니다.
값이 없는 경우 NULL을 반환합니다.
예:
input |
type(input) |
|---|---|
| NULL | "null" |
| 참 | "boolean" |
| 1 | "int32" |
| -3L | "int64" |
| 3.14 | "float64" |
| 2024-01-01T00:00:00Z UTC | "timestamp" |
| 'foo' | "string" |
| b"foo" | "bytes" |
| [1, 2] | "array" |
| {"a": 1} | "map" |
path("c/d") |
"reference" |
vector([1.0, 2.0]) |
"vector" |
| ABSENT | NULL |
클라이언트 예시
Node.js
const result = await db.pipeline() .collection("books") .select(field("title").notEqual("1984").as("not1984")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("title").notEqual("1984").as("not1984")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("title").notEqual("1984").as("not1984")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("title").notEqual("1984").alias("not1984")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("title").notEqual("1984").alias("not1984")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("title").not_equal("1984").as_("not1984")) .execute() )
자바
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(notEqual(field("title"), "1984").as("not1984")) .execute() .get();
IS_TYPE
구문:
is_type(input: ANY, type: STRING) -> BOOLEAN
설명:
input이 지정된 type과 일치하면 true를 반환하고, 그렇지 않으면 false를 반환합니다.
input이 없는 경우 NULL을 반환합니다.
지원되는 type 문자열은 다음과 같습니다.
"null""boolean""int32""int64""float64""decimal128""number""timestamp""string""bytes""array""map""reference""vector""geo_point""max_key""min_key""object_id""regex""bson_timestamp"
예:
input |
type |
is_type(input, type) |
|---|---|---|
| NULL | "null" | 참 |
| 참 | "boolean" | 참 |
| 3.14 | "float64" | 참 |
| 'foo' | "string" | 참 |
| b"foo" | "string" | 거짓 |
| [1, 2] | "array" | 참 |
| {"a": 1} | "map" | 참 |
vector([1.0, 2.0]) |
"vector" | 참 |
| ABSENT | "string" | NULL |
| 'bar' | "other" | 오류 |