टाइप फ़ंक्शन
| नाम | ब्यौरा |
TYPE
|
STRING के तौर पर वैल्यू का टाइप दिखाता है.
|
IS_TYPE
|
अगर वैल्यू, तय किए गए टाइप से मेल खाती है, तो true दिखाता है.
|
प्रकार
सिंटैक्स:
type(input: ANY) -> STRING
ब्यौरा:
input टाइप का स्ट्रिंग वर्शन दिखाता है.
अगर कोई वैल्यू मौजूद नहीं है, तो NULL दिखाता है.
उदाहरण:
input |
type(input) |
|---|---|
| NULL | "null" |
| सही | "बूलियन" |
| 1 | "int32" |
| -3L | "int64" |
| 3.14 | "float64" |
| 01-01-2024T00:00:00Z यूटीसी | "टाइमस्टैंप" |
| "foo" | "string" |
| b"foo" | "बाइट" |
| [1, 2] | "array" |
| {"a": 1} | "map" |
path("c/d") |
"रेफ़रंस" |
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() )
Java
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" | सही |
| सही | "बूलियन" | सही |
| 3.14 | "float64" | सही |
| "foo" | "string" | सही |
| b"foo" | "string" | गलत |
| [1, 2] | "array" | सही |
| {"a": 1} | "map" | सही |
vector([1.0, 2.0]) |
"vector" | सही |
| ABSENT | "string" | NULL |
| "bar" | "अन्य" | गड़बड़ी |