टाइप फ़ंक्शन

टाइप फ़ंक्शन

नाम ब्यौरा
TYPE वैल्यू के टाइप को STRING के तौर पर दिखाता है.
IS_TYPE अगर वैल्यू, तय किए गए टाइप से मैच होती है, तो true दिखाता है.

TYPE

सिंटैक्स:

type(input: ANY) -> STRING

Description:

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"
मौजूद नहीं है 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

Description:

अगर 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" सही
मौजूद नहीं है "string" NULL
"bar" "other" गड़बड़ी