এগ্রিগেট
aggregate(...) স্টেজে সব অ্যাগ্রিগেট ফাংশন টপ-লেভেল এক্সপ্রেশন হিসেবে ব্যবহার করা যেতে পারে।
| নাম | বিবরণ |
COUNT
|
ডকুমেন্টের সংখ্যা দেখায়। |
COUNT_IF
|
যেসব ডকুমেন্টে এক্সপ্রেশন মূল্যায়ন করে TRUE পাওয়া যায়, সেগুলির সংখ্যা দেখায়
|
COUNT_DISTINCT
|
অনন্য, NULL নয় এমন মানের সংখ্যা দেখায়
|
SUM
|
সব NUMERIC মানের যোগফল দেখায়
|
AVERAGE
|
সব NUMERIC ভ্যালুর গড় দেখায়
|
MINIMUM
|
ন্যূনতম নন-NULL ভ্যালু দেখায়
|
MAXIMUM
|
সর্বাধিক নন-NULL ভ্যালু দেখায়
|
FIRST
|
প্রথম ডকুমেন্টের জন্য expression ভ্যালু রিটার্ন করে।
|
LAST
|
শেষ ডকুমেন্টের জন্য expression ভ্যালু দেখায়।
|
ARRAY_AGG
|
সব ইনপুট ভ্যালুর অ্যারে দেখায়। |
ARRAY_AGG_DISTINCT
|
সব স্বতন্ত্র ইনপুট ভ্যালুর অ্যারে দেখায়। |
COUNT
সিনট্যাক্স:
count() -> INT64
count(expression: ANY) -> INT64
বিবরণ:
আগের ধাপ থেকে ডকুমেন্টের সংখ্যা দেখায় যেখানে expression
যেকোনও নন-NULL ভ্যালু হিসেবে মূল্যায়ন করে। কোনও expression প্রদান করা না হলে, আগের ধাপ থেকে
ডকুমেন্টের মোট সংখ্যা রিটার্ন করে।
Node.js
// Total number of books in the collection const countOfAll = await db.pipeline() .collection("books") .aggregate(countAll().as("count")) .execute(); // Number of books with nonnull `ratings` field const countField = await db.pipeline() .collection("books") .aggregate(field("ratings").count().as("count")) .execute();
Web
// Total number of books in the collection const countOfAll = await execute(db.pipeline() .collection("books") .aggregate(countAll().as("count")) ); // Number of books with nonnull `ratings` field const countField = await execute(db.pipeline() .collection("books") .aggregate(field("ratings").count().as("count")) );
Swift
// Total number of books in the collection let countAll = try await db.pipeline() .collection("books") .aggregate([CountAll().as("count")]) .execute() // Number of books with nonnull `ratings` field let countField = try await db.pipeline() .collection("books") .aggregate([Field("ratings").count().as("count")]) .execute()
Kotlin
// Total number of books in the collection val countAll = db.pipeline() .collection("books") .aggregate(AggregateFunction.countAll().alias("count")) .execute() // Number of books with nonnull `ratings` field val countField = db.pipeline() .collection("books") .aggregate(AggregateFunction.count("ratings").alias("count")) .execute()
Java
// Total number of books in the collection Task<Pipeline.Snapshot> countAll = db.pipeline() .collection("books") .aggregate(AggregateFunction.countAll().alias("count")) .execute(); // Number of books with nonnull `ratings` field Task<Pipeline.Snapshot> countField = db.pipeline() .collection("books") .aggregate(AggregateFunction.count("ratings").alias("count")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Count # Total number of books in the collection count_all = ( client.pipeline().collection("books").aggregate(Count().as_("count")).execute() ) # Number of books with nonnull `ratings` field count_field = ( client.pipeline() .collection("books") .aggregate(Count("ratings").as_("count")) .execute() )
জাভা
// Total number of books in the collection Pipeline.Snapshot countAll = firestore.pipeline().collection("books").aggregate(countAll().as("count")).execute().get(); // Number of books with nonnull `ratings` field Pipeline.Snapshot countField = firestore .pipeline() .collection("books") .aggregate(count("ratings").as("count")) .execute() .get();
Go
// Total number of books in the collection countAll, err := client.Pipeline().Collection("books"). Aggregate(firestore.Accumulators(firestore.CountAll().As("count"))). Execute(ctx).Results().GetAll() if err != nil { fmt.Fprintf(w, "GetAll failed: %v", err) return err } // Number of books with nonnull `ratings` field countField, err := client.Pipeline(). Collection("books"). Aggregate(firestore.Accumulators(firestore.Count("ratings").As("count"))). Execute(ctx).Results().GetAll() if err != nil { fmt.Fprintf(w, "GetAll failed: %v", err) return err }
COUNT_IF
সিনট্যাক্স:
count_if(expression: BOOLEAN) -> INT64
বিবরণ:
আগের ধাপ থেকে ডকুমেন্টের সংখ্যা দেখায় যেখানে expression
TRUE হিসেবে মূল্যায়ন করে।
Node.js
const result = await db.pipeline() .collection("books") .aggregate( field("rating").greaterThan(4).countIf().as("filteredCount") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .aggregate( field("rating").greaterThan(4).countIf().as("filteredCount") ) );
Swift
let result = try await db.pipeline() .collection("books") .aggregate([ AggregateFunction("count_if", [Field("rating").greaterThan(4)]).as("filteredCount") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .aggregate( AggregateFunction.countIf(field("rating").greaterThan(4)).alias("filteredCount") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .aggregate( AggregateFunction.countIf(field("rating").greaterThan(4)).alias("filteredCount") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .aggregate(Field.of("rating").greater_than(4).count_if().as_("filteredCount")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .aggregate(countIf(field("rating").greaterThan(4)).as("filteredCount")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Aggregate(firestore.Accumulators( firestore.CountIf(firestore.FieldOf("rating").GreaterThan(4)).As("filteredCount"), )). Execute(ctx)
COUNT_DISTINCT
সিনট্যাক্স:
count_distinct(expression: ANY) -> INT64
বিবরণ:
expression-এর অনন্য নন-NULL, নন-ABSENT মানের সংখ্যা দেখায়।
Node.js
const result = await db.pipeline() .collection("books") .aggregate(field("author").countDistinct().as("unique_authors")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .aggregate(field("author").countDistinct().as("unique_authors")) );
Swift
let result = try await db.pipeline() .collection("books") .aggregate([AggregateFunction("count_distinct", [Field("author")]).as("unique_authors")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .aggregate(AggregateFunction.countDistinct("author").alias("unique_authors")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .aggregate(AggregateFunction.countDistinct("author").alias("unique_authors")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .aggregate(Field.of("author").count_distinct().as_("unique_authors")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .aggregate(countDistinct("author").as("unique_authors")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Aggregate(firestore.Accumulators( firestore.CountDistinct("author").As("unique_authors"), )). Execute(ctx)
SUM
সিনট্যাক্স:
sum(expression: ANY) -> NUMBER
বিবরণ:
সংখ্যা নয় এমন মান বাদ দিয়ে সব সংখ্যাগত মানের যোগফল দেখায়। কোনও ভ্যালু NaN হলে
NaN রিটার্ন করে।
এইসব ক্ষেত্রে ছাড়া, আউটপুটের ধরন ইনপুটের সবচেয়ে বড় ধরনের মতোই হবে:
INTEGER-কেINTEGERহিসেবে দেখানো না গেলে, সেটিDOUBLE-এ কনভার্ট করা হবে।
Node.js
const result = await db.pipeline() .collection("cities") .aggregate(field("population").sum().as("totalPopulation")) .execute();
Web
const result = await execute(db.pipeline() .collection("cities") .aggregate(field("population").sum().as("totalPopulation")) );
Swift
let result = try await db.pipeline() .collection("cities") .aggregate([Field("population").sum().as("totalPopulation")]) .execute()
Kotlin
val result = db.pipeline() .collection("cities") .aggregate(AggregateFunction.sum("population").alias("totalPopulation")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("cities") .aggregate(AggregateFunction.sum("population").alias("totalPopulation")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("cities") .aggregate(Field.of("population").sum().as_("totalPopulation")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("cities") .aggregate(sum("population").as("totalPopulation")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("cities"). Aggregate(firestore.Accumulators( firestore.Sum("population").As("totalPopulation"), )). Execute(ctx)
AVERAGE
সিনট্যাক্স:
average(expression: ANY) -> FLOAT64
বিবরণ:
সংখ্যা নয় এমন মান বাদ দিয়ে, সব সংখ্যাগত মানের গড় দেখায়।
কোনও ভ্যালু NaN হলে NaN হিসেবে মূল্যায়ন করে, অথবা কোনও সংখ্যাসূচক ভ্যালু অ্যাগ্রিগেট করা না হলে NULL হিসেবে মূল্যায়ন করে।
এইসব ক্ষেত্রে ছাড়া, আউটপুটের ধরন ইনপুটের ধরনের মতোই হবে:
INTEGER-কেINTEGERহিসেবে দেখানো না গেলে, সেটিDOUBLE-এ কনভার্ট করা হবে।
Node.js
const result = await db.pipeline() .collection("cities") .aggregate(field("population").average().as("averagePopulation")) .execute();
Web
const result = await execute(db.pipeline() .collection("cities") .aggregate(field("population").average().as("averagePopulation")) );
Swift
let result = try await db.pipeline() .collection("cities") .aggregate([Field("population").average().as("averagePopulation")]) .execute()
Kotlin
val result = db.pipeline() .collection("cities") .aggregate(AggregateFunction.average("population").alias("averagePopulation")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("cities") .aggregate(AggregateFunction.average("population").alias("averagePopulation")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("cities") .aggregate(Field.of("population").average().as_("averagePopulation")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("cities") .aggregate(average("population").as("averagePopulation")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("cities"). Aggregate(firestore.Accumulators( firestore.Average("population").As("averagePopulation"), )). Execute(ctx)
ন্যূনতম
সিনট্যাক্স:
minimum(expression: ANY) -> ANY
বিবরণ:
প্রতিটি ডকুমেন্ট মূল্যায়ন করার সময় expression-এর সর্বনিম্ন নন-NULL, নন-অ্যাবসেন্ট ভ্যালু দেখায়।
যদি কোনও নন-NULL, নন-অ্যাবসেন্ট ভ্যালু না থাকে, তাহলে NULL রিটার্ন করা হয়। কোনও ডকুমেন্ট বিবেচনা করা না হলে এটি অন্তর্ভুক্ত করা হয়।
একাধিক ন্যূনতম সমতুল্য মান থাকলে, সেই মানগুলির মধ্যে যেকোনও একটি ফেরত দেওয়া যেতে পারে। ভ্যালুর ধরন ডকুমেন্ট করা ক্রম অনুযায়ী সাজানো হয়।
Node.js
const result = await db.pipeline() .collection("books") .aggregate(field("price").minimum().as("minimumPrice")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").minimum().as("minimumPrice")) );
Swift
let result = try await db.pipeline() .collection("books") .aggregate([Field("price").minimum().as("minimumPrice")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .aggregate(AggregateFunction.minimum("price").alias("minimumPrice")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .aggregate(AggregateFunction.minimum("price").alias("minimumPrice")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .aggregate(Field.of("price").minimum().as_("minimumPrice")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .aggregate(minimum("price").as("minimumPrice")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Aggregate(firestore.Accumulators( firestore.Minimum("price").As("minimumPrice"), )). Execute(ctx)
সর্বাধিক
সিনট্যাক্স:
maximum(expression: ANY) -> ANY
বিবরণ:
প্রতিটি ডকুমেন্টে মূল্যায়ন করার সময় expression-এর সর্বাধিক নন-NULL, নন-অ্যাবসেন্ট ভ্যালু দেখায়।
যদি কোনও নন-NULL, নন-অ্যাবসেন্ট ভ্যালু না থাকে, তাহলে NULL রিটার্ন করা হয়। কোনও ডকুমেন্ট বিবেচনা করা না হলে এটি অন্তর্ভুক্ত করা হয়।
একাধিক সর্বাধিক সমতুল্য মান থাকলে, সেই মানগুলির মধ্যে যেকোনও একটি ফেরত দেওয়া যেতে পারে। ভ্যালুর ধরন ডকুমেন্ট করা ক্রম অনুযায়ী সাজানো হয়।
Node.js
const result = await db.pipeline() .collection("books") .aggregate(field("price").maximum().as("maximumPrice")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").maximum().as("maximumPrice")) );
Swift
let result = try await db.pipeline() .collection("books") .aggregate([Field("price").maximum().as("maximumPrice")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .aggregate(AggregateFunction.maximum("price").alias("maximumPrice")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .aggregate(AggregateFunction.maximum("price").alias("maximumPrice")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .aggregate(Field.of("price").maximum().as_("maximumPrice")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .aggregate(maximum("price").as("maximumPrice")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Aggregate(firestore.Accumulators( firestore.Maximum("price").As("maximumPrice"), )). Execute(ctx)
প্রথম
সিনট্যাক্স:
first(expression: ANY) -> ANY
বিবরণ:
প্রথম ফেরত আসা ডকুমেন্টের জন্য expression-এর ভ্যালু ফেরত দেয়।
শেষ
সিনট্যাক্স:
last(expression: ANY) -> ANY
বিবরণ:
শেষবার ফেরত পাঠানো ডকুমেন্টের জন্য expression-এর ভ্যালু দেখায়।
ARRAY_AGG
সিনট্যাক্স:
array_agg(expression: ANY) -> ARRAY<ANY>
বিবরণ:
প্রতিটি ডকুমেন্টে মূল্যায়ন করার সময় expression-এর সব ভ্যালু সহ একটি অ্যারে রিটার্ন করে।
এক্সপ্রেশনটি কোনও অনুপস্থিত ভ্যালুতে সমাধান করলে, এটি NULL-এ কনভার্ট করা হয়।
আউটপুট অ্যারেতে এলিমেন্টের ক্রম স্থির নয় এবং এর উপর নির্ভর করা উচিত নয়।
ARRAY_AGG_DISTINCT
সিনট্যাক্স:
array_agg_distinct(expression: ANY) -> ARRAY<ANY>
বিবরণ:
প্রতিটি ডকুমেন্ট মূল্যায়ন করার সময় expression-এর সব স্বতন্ত্র ভ্যালু সহ একটি অ্যারে রিটার্ন করে।
এক্সপ্রেশনটি কোনও অনুপস্থিত ভ্যালুতে সমাধান করলে, এটি NULL-এ কনভার্ট করা হয়।
আউটপুট অ্যারেতে এলিমেন্টের ক্রম স্থির নয় এবং এর উপর নির্ভর করা উচিত নয়।
পাটিগণিত ফাংশন
Cloud Firestore-এর সব পাটিগণিত ফাংশনের নিম্নলিখিত আচরণ আছে:
- ইনপুট প্যারামিটারের মধ্যে কোনও একটি
NULLহলে,NULLহিসেবে মূল্যায়ন করে। - যেকোনও আর্গুমেন্ট
NaNহলে,NaNহিসেবে মূল্যায়ন করে। - ওভারফ্লো বা আন্ডারফ্লো হলে একটি ত্রুটি তৈরি করে।
Cloud Firestore নিম্নলিখিত ক্রম অনুযায়ী নিউমেরিক টাইপ ওয়াইডেনিং পারফর্ম করে: INT32 < INT64 < FLOAT64 < DECIMAL128. যখন কোনও অ্যারিথমেটিক
ফাংশন বিভিন্ন ধরনের একাধিক সংখ্যাসূচক আর্গুমেন্ট নেয় (যেমন,
add(5.0D, 6L)), তখন সংকীর্ণ প্রকারগুলি অন্তর্নিহিতভাবে অপারেন্ডের মধ্যে উপস্থিত
সবচেয়ে প্রশস্ত প্রকারে রূপান্তরিত হয়। আগের উদাহরণে, 6L-কে 6.0D-এ
পরিবর্তন করা হয়েছে, যার ফলে এক্সপ্রেশনটি FLOAT64 টাইপ রিটার্ন করে।
INT64 -> FLOAT64 থেকে একটি অন্তর্নিহিত জবরদস্তি নির্ভুলতার ক্ষতি করতে পারে
কারণ জবরদস্তিমূলক মান তার সবচেয়ে কম উল্লেখযোগ্য বিট হারাতে পারে। ফলাফল হিসেবে পাওয়া ভ্যালু
IEEE 754 রাউন্ড-টু-নিয়ারেস্ট মোড ব্যবহার করে আসল পূর্ণ সংখ্যার ভ্যালুর রাউন্ড করা ভার্সন
হবে।
| নাম | বিবরণ |
ABS
|
number-এর পরম মান দেখায়
|
ADD
|
x + y-এর মান রিটার্ন করে
|
SUBTRACT
|
x - y-এর মান রিটার্ন করে
|
MULTIPLY
|
x * y-এর মান রিটার্ন করে
|
DIVIDE
|
x / y-এর মান রিটার্ন করে
|
MOD
|
x / y-এর ভাগের ভাগশেষ দেখায়
|
CEIL
|
number-এর সিলিং দেখায়
|
FLOOR
|
number-এর ফ্লোর রিটার্ন করে
|
ROUND
|
number-কে places দশমিক স্থান পর্যন্ত রাউন্ড করে
|
TRUNC
|
number-কে places দশমিক স্থান পর্যন্ত ট্রাঙ্কেট করে
|
POW
|
base^exponent-এর মান রিটার্ন করে
|
SQRT
|
number-এর বর্গমূল দেখায়
|
EXP
|
exponent-এর সূচক হিসেবে অয়লারের সংখ্যা দেখায়
|
LN
|
number-এর ন্যাচারাল লগারিদম দেখায়
|
LOG
|
number-এর লগারিদম দেখায়
|
LOG10
|
10 বেসের সাপেক্ষে number-এর লগারিদম দেখায়
|
RAND
|
সিউডো-র্যান্ডম ফ্লোটিং পয়েন্ট নম্বর দেখায় |
ABS
সিনট্যাক্স:
abs[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](number: N) -> N
বিবরণ:
number-এর পরম মান দেখায়।
- ফাংশনটি
INT32বাINT64মান ওভারফ্লো করলে একটি ত্রুটি দেখায়।
উদাহরণ:
| নম্বর | abs(number) |
|---|---|
| 10 | 10 |
| -10 | 10 |
| ১০ লাখ | ১০ লাখ |
| -০.০ | 0.0 |
| ১০.৫ | ১০.৫ |
| -১০.৫ | ১০.৫ |
| -২৩১ | [error] |
| -২৬৩ | [error] |
যোগ করুন
সিনট্যাক্স:
add[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](x: N, y: N) -> N
বিবরণ:
x + y-এর ভ্যালু দেখায়।
উদাহরণ:
| x | y | add(x, y) |
|---|---|---|
| 20 | 3 | 23 |
| ১০.০ | 1 | ১১.০ |
| 22.5 | 2.0 | ২৪.৫ |
| INT64.MAX | 1 | [error] |
| INT64.MIN | -১ | [error] |
Node.js
const result = await db.pipeline() .collection("books") .select(field("soldBooks").add(field("unsoldBooks")).as("totalBooks")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("soldBooks").add(field("unsoldBooks")).as("totalBooks")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("soldBooks").add(Field("unsoldBooks")).as("totalBooks")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(Expression.add(field("soldBooks"), field("unsoldBooks")).alias("totalBooks")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.add(field("soldBooks"), field("unsoldBooks")).alias("totalBooks")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("soldBooks").add(Field.of("unsoldBooks")).as_("totalBooks")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(add(field("soldBooks"), field("unsoldBooks")).as("totalBooks")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Add(firestore.FieldOf("soldBooks"), firestore.FieldOf("unsoldBooks")).As("totalBooks"), )). Execute(ctx)
বিয়োগ করুন
সিনট্যাক্স:
subtract[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](x: N, y: N) -> N
বিবরণ:
x - y-এর ভ্যালু দেখায়।
উদাহরণ:
| x | y | subtract(x, y) |
|---|---|---|
| 20 | 3 | 17 |
| ১০.০ | 1 | ৯.০ |
| 22.5 | 2.0 | 20.5 |
| INT64.MAX | -১ | [error] |
| INT64.MIN | 1 | [error] |
Node.js
const storeCredit = 7; const result = await db.pipeline() .collection("books") .select(field("price").subtract(constant(storeCredit)).as("totalCost")) .execute();
Web
const storeCredit = 7; const result = await execute(db.pipeline() .collection("books") .select(field("price").subtract(constant(storeCredit)).as("totalCost")) );
Swift
let storeCredit = 7 let result = try await db.pipeline() .collection("books") .select([Field("price").subtract(Constant(storeCredit)).as("totalCost")]) .execute()
Kotlin
val storeCredit = 7 val result = db.pipeline() .collection("books") .select(Expression.subtract(field("price"), storeCredit).alias("totalCost")) .execute()
Java
int storeCredit = 7; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.subtract(field("price"), storeCredit).alias("totalCost")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field store_credit = 7 result = ( client.pipeline() .collection("books") .select(Field.of("price").subtract(store_credit).as_("totalCost")) .execute() )
জাভা
int storeCredit = 7; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(subtract(field("price"), storeCredit).as("totalCost")) .execute() .get();
Go
storeCredit := 7 snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Subtract(firestore.FieldOf("price"), storeCredit).As("totalCost"), )). Execute(ctx)
MULTIPLY
সিনট্যাক্স:
multiply[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](x: N, y: N) -> N
বিবরণ:
x * y-এর ভ্যালু দেখায়।
উদাহরণ:
| x | y | multiply(x, y) |
|---|---|---|
| 20 | 3 | 60 |
| ১০.০ | 1 | ১০.০ |
| 22.5 | 2.0 | ৪৫.০ |
| INT64.MAX | 2 | [error] |
| INT64.MIN | 2 | [error] |
| FLOAT64.MAX | FLOAT64.MAX | +inf |
Node.js
const result = await db.pipeline() .collection("books") .select(field("price").multiply(field("soldBooks")).as("revenue")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("price").multiply(field("soldBooks")).as("revenue")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("price").multiply(Field("soldBooks")).as("revenue")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(Expression.multiply(field("price"), field("soldBooks")).alias("revenue")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.multiply(field("price"), field("soldBooks")).alias("revenue")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("price").multiply(Field.of("soldBooks")).as_("revenue")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(multiply(field("price"), field("soldBooks")).as("revenue")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Multiply(firestore.FieldOf("price"), firestore.FieldOf("soldBooks")).As("revenue"), )). Execute(ctx)
ভাগ
সিনট্যাক্স:
divide[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](x: N, y: N) -> N
বিবরণ:
x / y-এর ভ্যালু দেখায়। পূর্ণসংখ্যা বিভাজন ট্রাঙ্কেট করা হয়েছে।
উদাহরণ:
| x | y | divide(x, y) |
|---|---|---|
| 20 | 3 | 6 |
| ১০.০ | 3 | 3.333... |
| 22.5 | 2 | ১১.২৫ |
| 10 | 0 | [error] |
| 1.0 | 0.0 | +inf |
| -১.০ | 0.0 | -inf |
| 0.0 | 0.0 | NaN |
+inf |
+inf |
NaN |
Node.js
const result = await db.pipeline() .collection("books") .select(field("ratings").divide(field("soldBooks")).as("reviewRate")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("ratings").divide(field("soldBooks")).as("reviewRate")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("ratings").divide(Field("soldBooks")).as("reviewRate")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(Expression.divide(field("ratings"), field("soldBooks")).alias("reviewRate")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.divide(field("ratings"), field("soldBooks")).alias("reviewRate")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("ratings").divide(Field.of("soldBooks")).as_("reviewRate")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(divide(field("ratings"), field("soldBooks")).as("reviewRate")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Divide(firestore.FieldOf("ratings"), firestore.FieldOf("soldBooks")).As("reviewRate"), )). Execute(ctx)
MOD
সিনট্যাক্স:
mod[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](x: N, y: N) -> N
বিবরণ:
x / y-এর ভাগশেষ দেখায়।
y-এর মান পূর্ণ সংখ্যার (INT64) জন্য শূন্য হলেerrorদেখায়।- ফ্লোট টাইপের (
FLOAT64) জন্যyশূন্য হলেNaNরিটার্ন করে।
উদাহরণ:
| x | y | mod(x, y) |
|---|---|---|
| 20 | 3 | 2 |
| -10 | 3 | -১ |
| 10 | -৩ | 1 |
| -10 | -৩ | -১ |
| 10 | 1 | 0 |
| 22.5 | 2 | ০.৫ |
| 22.5 | 0.0 | NaN |
| 25 | 0 | [error] |
Node.js
const displayCapacity = 1000; const result = await db.pipeline() .collection("books") .select(field("unsoldBooks").mod(constant(displayCapacity)).as("warehousedBooks")) .execute();
Web
const displayCapacity = 1000; const result = await execute(db.pipeline() .collection("books") .select(field("unsoldBooks").mod(constant(displayCapacity)).as("warehousedBooks")) );
Swift
let displayCapacity = 1000 let result = try await db.pipeline() .collection("books") .select([Field("unsoldBooks").mod(Constant(displayCapacity)).as("warehousedBooks")]) .execute()
Kotlin
val displayCapacity = 1000 val result = db.pipeline() .collection("books") .select(Expression.mod(field("unsoldBooks"), displayCapacity).alias("warehousedBooks")) .execute()
Java
int displayCapacity = 1000; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.mod(field("unsoldBooks"), displayCapacity).alias("warehousedBooks")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field display_capacity = 1000 result = ( client.pipeline() .collection("books") .select(Field.of("unsoldBooks").mod(display_capacity).as_("warehousedBooks")) .execute() )
জাভা
int displayCapacity = 1000; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(mod(field("unsoldBooks"), displayCapacity).as("warehousedBooks")) .execute() .get();
Go
displayCapacity := 1000 snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Mod(firestore.FieldOf("unsoldBooks"), displayCapacity).As("warehousedBooks"), )). Execute(ctx)
CEIL
সিনট্যাক্স:
ceil[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](number: N) -> N
বিবরণ:
number-এর থেকে কম নয় এমন ক্ষুদ্রতম পূর্ণসংখ্যা দেখায়।
উদাহরণ:
| নম্বর | ceil(number) |
|---|---|
| 20 | 20 |
| 10 | 10 |
| 0 | 0 |
| 24L | 24L |
| -0.4 | -০.০ |
| ০.৪ | 1.0 |
| 22.5 | ২৩.০ |
NaN |
NaN |
+inf |
+inf |
-inf |
-inf |
Node.js
const booksPerShelf = 100; const result = await db.pipeline() .collection("books") .select( field("unsoldBooks").divide(constant(booksPerShelf)).ceil().as("requiredShelves") ) .execute();
Web
const booksPerShelf = 100; const result = await execute(db.pipeline() .collection("books") .select( field("unsoldBooks").divide(constant(booksPerShelf)).ceil().as("requiredShelves") ) );
Swift
let booksPerShelf = 100 let result = try await db.pipeline() .collection("books") .select([ Field("unsoldBooks").divide(Constant(booksPerShelf)).ceil().as("requiredShelves") ]) .execute()
Kotlin
val booksPerShelf = 100 val result = db.pipeline() .collection("books") .select( Expression.divide(field("unsoldBooks"), booksPerShelf).ceil().alias("requiredShelves") ) .execute()
Java
int booksPerShelf = 100; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( Expression.divide(field("unsoldBooks"), booksPerShelf).ceil().alias("requiredShelves") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field books_per_shelf = 100 result = ( client.pipeline() .collection("books") .select( Field.of("unsoldBooks") .divide(books_per_shelf) .ceil() .as_("requiredShelves") ) .execute() )
জাভা
int booksPerShelf = 100; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(ceil(divide(field("unsoldBooks"), booksPerShelf)).as("requiredShelves")) .execute() .get();
Go
booksPerShelf := 100 snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Ceil(firestore.Divide(firestore.FieldOf("unsoldBooks"), booksPerShelf)).As("requiredShelves"), )). Execute(ctx)
FLOOR
সিনট্যাক্স:
floor[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](number: N) -> N
বিবরণ:
number-এর থেকে বড় নয় এমন সবচেয়ে বড় পূর্ণসংখ্যার মান দেখায়।
উদাহরণ:
| নম্বর | floor(number) |
|---|---|
| 20 | 20 |
| 10 | 10 |
| 0 | 0 |
| 2147483648 | 2147483648 |
| -0.4 | -১.০ |
| ০.৪ | 0.0 |
| 22.5 | ২২.০ |
NaN |
NaN |
+inf |
+inf |
-inf |
-inf |
Node.js
const result = await db.pipeline() .collection("books") .addFields( field("wordCount").divide(field("pages")).floor().as("wordsPerPage") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .addFields( field("wordCount").divide(field("pages")).floor().as("wordsPerPage") ) );
Swift
let result = try await db.pipeline() .collection("books") .addFields([ Field("wordCount").divide(Field("pages")).floor().as("wordsPerPage") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .addFields( Expression.divide(field("wordCount"), field("pages")).floor().alias("wordsPerPage") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .addFields( Expression.divide(field("wordCount"), field("pages")).floor().alias("wordsPerPage") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .add_fields( Field.of("wordCount").divide(Field.of("pages")).floor().as_("wordsPerPage") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .addFields(floor(divide(field("wordCount"), field("pages"))).as("wordsPerPage")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). AddFields(firestore.Selectables( firestore.Floor(firestore.Divide(firestore.FieldOf("wordCount"), firestore.FieldOf("pages"))).As("wordsPerPage"), )). Execute(ctx)
ROUND
সিনট্যাক্স:
round[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](number: N) -> N
round[N <: INT32 | INT64 | FLOAT64 | DECIMAL128](number: N, places: INT64) -> N
বিবরণ:
number-এর places সংখ্যা রাউন্ড অফ করে। places পজিটিভ হলে, দশমিক বিন্দুর ডানদিকের সংখ্যাকে এবং নেগেটিভ হলে, দশমিক বিন্দুর বাঁদিকের সংখ্যাকে রাউন্ড করে।
- শুধু
numberদেওয়া হলে, সবচেয়ে কাছের পূর্ণ সংখ্যায় রাউন্ড করা হয়। - হাফওয়ে কেসের ক্ষেত্রে শূন্য থেকে দূরে রাউন্ড করে।
- নেগেটিভ
placesভ্যালু দিয়ে রাউন্ড করার ফলে ওভারফ্লো হলে,errorথ্রো করা হয়।
উদাহরণ:
| নম্বর | স্থানসমূহ | round(number, places) |
|---|---|---|
| ১৫.৫ | 0 | ১৬.০ |
| -15.5 | 0 | -১৬.০ |
| 15 | 1 | 15 |
| 15 | 0 | 15 |
| 15 | -১ | 20 |
| 15 | -২ | 0 |
| 15.48924 | 1 | ১৫.৫ |
| ২৩১-১ | -১ | [error] |
| ২৬৩-১L | -১ | [error] |
Node.js
const result = await db.pipeline() .collection("books") .select(field("soldBooks").multiply(field("price")).round().as("partialRevenue")) .aggregate(field("partialRevenue").sum().as("totalRevenue")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("soldBooks").multiply(field("price")).round().as("partialRevenue")) .aggregate(field("partialRevenue").sum().as("totalRevenue")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("soldBooks").multiply(Field("price")).round().as("partialRevenue")]) .aggregate([Field("partialRevenue").sum().as("totalRevenue")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(Expression.multiply(field("soldBooks"), field("price")).round().alias("partialRevenue")) .aggregate(AggregateFunction.sum("partialRevenue").alias("totalRevenue")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(Expression.multiply(field("soldBooks"), field("price")).round().alias("partialRevenue")) .aggregate(AggregateFunction.sum("partialRevenue").alias("totalRevenue")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("soldBooks") .multiply(Field.of("price")) .round() .as_("partialRevenue") ) .aggregate(Field.of("partialRevenue").sum().as_("totalRevenue")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(round(multiply(field("soldBooks"), field("price"))).as("partialRevenue")) .aggregate(sum("partialRevenue").as("totalRevenue")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Round(firestore.Multiply(firestore.FieldOf("soldBooks"), firestore.FieldOf("price"))).As("partialRevenue"), )). Aggregate(firestore.Accumulators( firestore.Sum("partialRevenue").As("totalRevenue"), )). Execute(ctx)
TRUNC
সিনট্যাক্স:
trunc[N <: Number](number: N) -> N
trunc[N <: Number](number: N, places: INT64) -> N
বিবরণ:
number-কে নির্দিষ্ট সংখ্যক places দশমিক স্থানে ট্রাঙ্কেট করে। places পজিটিভ হলে দশমিক বিন্দুর ডানদিকে এবং নেগেটিভ হলে দশমিক বিন্দুর বাঁদিকে
সংখ্যা ট্রাঙ্কেট করে।
- শুধুমাত্র
numberপ্রদান করা হলে, শূন্যের কাছাকাছি পূর্ণ সংখ্যায় ট্রাঙ্কেট করা হয়। - ট্রাঙ্কেট করার ফলে ওভারফ্লো হলে
errorথ্রো করা হয়।
উদাহরণ:
| নম্বর | স্থানসমূহ | trunc(number, places) |
|---|---|---|
| ১৫.৫ | 0 | 15.0 |
| -15.5 | 0 | -১৫.০ |
| 15 | 1 | 15 |
| 15 | 0 | 15 |
| 15 | -১ | 10 |
| 15 | -২ | 0 |
| 15.48924 | 1 | 15.4 |
| -15.48924 | 2 | -১৫.৪৮ |
POW
সিনট্যাক্স:
pow(base: FLOAT64, exponent: FLOAT64) -> FLOAT64
বিবরণ:
base ভ্যালুর exponent ঘাত দেখায়।
base <= 0এবংexponentনেগেটিভ হলে সমস্যা দেখায়।যেকোনও
exponent-এর (NaNসহ) জন্য,pow(1, exponent)হল ১।যেকোনও
base-এর (NaNসহ) জন্য,pow(base, 0)হল ১।
উদাহরণ:
| বেস | ঘাত | pow(base, exponent) |
|---|---|---|
| 2 | 3 | ৮.০ |
| 2 | -৩ | ০.১২৫ |
+inf |
0 | 1.0 |
| 1 | +inf |
1.0 |
NaN |
0 | 1.0 |
| 1 | NaN |
1.0 |
NaN |
Numeric |
NaN |
Numeric |
NaN |
NaN |
| -১ | ০.৫ | [error] |
| 0 | -১ | [error] |
Node.js
const googleplex = { latitude: 37.4221, longitude: 122.0853 }; const result = await db.pipeline() .collection("cities") .addFields( field("lat").subtract(constant(googleplex.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), field("lng").subtract(constant(googleplex.longitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ) .execute();
Web
const googleplex = { latitude: 37.4221, longitude: 122.0853 }; const result = await execute(db.pipeline() .collection("cities") .addFields( field("lat").subtract(constant(googleplex.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), field("lng").subtract(constant(googleplex.longitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ) );
Swift
let googleplex = CLLocation(latitude: 37.4221, longitude: 122.0853) let result = try await db.pipeline() .collection("cities") .addFields([ Field("lat").subtract(Constant(googleplex.coordinate.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), Field("lng").subtract(Constant(googleplex.coordinate.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ]) .select([ Field("latitudeDifference").add(Field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ]) .execute()
Kotlin
val googleplex = GeoPoint(37.4221, -122.0853) val result = db.pipeline() .collection("cities") .addFields( field("lat").subtract(googleplex.latitude) .multiply(111) // km per degree .pow(2) .alias("latitudeDifference"), field("lng").subtract(googleplex.longitude) .multiply(111) // km per degree .pow(2) .alias("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .alias("approximateDistanceToGoogle") ) .execute()
Java
GeoPoint googleplex = new GeoPoint(37.4221, -122.0853); Task<Pipeline.Snapshot> result = db.pipeline() .collection("cities") .addFields( field("lat").subtract(googleplex.getLatitude()) .multiply(111 /* km per degree */) .pow(2) .alias("latitudeDifference"), field("lng").subtract(googleplex.getLongitude()) .multiply(111 /* km per degree */) .pow(2) .alias("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .alias("approximateDistanceToGoogle") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field googleplexLat = 37.4221 googleplexLng = -122.0853 result = ( client.pipeline() .collection("cities") .add_fields( Field.of("lat") .subtract(googleplexLat) .multiply(111) # km per degree .pow(2) .as_("latitudeDifference"), Field.of("lng") .subtract(googleplexLng) .multiply(111) # km per degree .pow(2) .as_("longitudeDifference"), ) .select( Field.of("latitudeDifference") .add(Field.of("longitudeDifference")) .sqrt() # Inaccurate for large distances or close to poles .as_("approximateDistanceToGoogle") ) .execute() )
জাভা
double googleplexLat = 37.4221; double googleplexLng = -122.0853; Pipeline.Snapshot result = firestore .pipeline() .collection("cities") .addFields( pow(multiply(subtract(field("lat"), googleplexLat), 111), 2) .as("latitudeDifference"), pow(multiply(subtract(field("lng"), googleplexLng), 111), 2) .as("longitudeDifference")) .select( sqrt(add(field("latitudeDifference"), field("longitudeDifference"))) // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle")) .execute() .get();
Go
googleplexLat := 37.4221 googleplexLng := -122.0853 snapshot := client.Pipeline(). Collection("cities"). AddFields(firestore.Selectables( firestore.Pow(firestore.Multiply(firestore.Subtract(firestore.FieldOf("lat"), googleplexLat), 111), 2).As("latitudeDifference"), firestore.Pow(firestore.Multiply(firestore.Subtract(firestore.FieldOf("lng"), googleplexLng), 111), 2).As("longitudeDifference"), )). Select(firestore.Fields( firestore.Sqrt(firestore.Add(firestore.FieldOf("latitudeDifference"), firestore.FieldOf("longitudeDifference"))). // Inaccurate for large distances or close to poles As("approximateDistanceToGoogle"), )). Execute(ctx)
SQRT
সিনট্যাক্স:
sqrt[N <: FLOAT64 | DECIMAL128](number: N) -> N
বিবরণ:
number-এর বর্গমূল দেখায়।
numberনেতিবাচক হলেerrorদেখায়।
উদাহরণ:
| নম্বর | sqrt(number) |
|---|---|
| 25 | ৫.০ |
| ১২.০০২ | 3.464... |
| 0.0 | 0.0 |
NaN |
NaN |
+inf |
+inf |
-inf |
[error] |
x < 0 |
[error] |
Node.js
const googleplex = { latitude: 37.4221, longitude: 122.0853 }; const result = await db.pipeline() .collection("cities") .addFields( field("lat").subtract(constant(googleplex.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), field("lng").subtract(constant(googleplex.longitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ) .execute();
Web
const googleplex = { latitude: 37.4221, longitude: 122.0853 }; const result = await execute(db.pipeline() .collection("cities") .addFields( field("lat").subtract(constant(googleplex.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), field("lng").subtract(constant(googleplex.longitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ) );
Swift
let googleplex = CLLocation(latitude: 37.4221, longitude: 122.0853) let result = try await db.pipeline() .collection("cities") .addFields([ Field("lat").subtract(Constant(googleplex.coordinate.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("latitudeDifference"), Field("lng").subtract(Constant(googleplex.coordinate.latitude)) .multiply(111 /* km per degree */) .pow(2) .as("longitudeDifference") ]) .select([ Field("latitudeDifference").add(Field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle") ]) .execute()
Kotlin
val googleplex = GeoPoint(37.4221, -122.0853) val result = db.pipeline() .collection("cities") .addFields( field("lat").subtract(googleplex.latitude) .multiply(111) // km per degree .pow(2) .alias("latitudeDifference"), field("lng").subtract(googleplex.longitude) .multiply(111) // km per degree .pow(2) .alias("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .alias("approximateDistanceToGoogle") ) .execute()
Java
GeoPoint googleplex = new GeoPoint(37.4221, -122.0853); Task<Pipeline.Snapshot> result = db.pipeline() .collection("cities") .addFields( field("lat").subtract(googleplex.getLatitude()) .multiply(111 /* km per degree */) .pow(2) .alias("latitudeDifference"), field("lng").subtract(googleplex.getLongitude()) .multiply(111 /* km per degree */) .pow(2) .alias("longitudeDifference") ) .select( field("latitudeDifference").add(field("longitudeDifference")).sqrt() // Inaccurate for large distances or close to poles .alias("approximateDistanceToGoogle") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field googleplexLat = 37.4221 googleplexLng = -122.0853 result = ( client.pipeline() .collection("cities") .add_fields( Field.of("lat") .subtract(googleplexLat) .multiply(111) # km per degree .pow(2) .as_("latitudeDifference"), Field.of("lng") .subtract(googleplexLng) .multiply(111) # km per degree .pow(2) .as_("longitudeDifference"), ) .select( Field.of("latitudeDifference") .add(Field.of("longitudeDifference")) .sqrt() # Inaccurate for large distances or close to poles .as_("approximateDistanceToGoogle") ) .execute() )
জাভা
double googleplexLat = 37.4221; double googleplexLng = -122.0853; Pipeline.Snapshot result = firestore .pipeline() .collection("cities") .addFields( pow(multiply(subtract(field("lat"), googleplexLat), 111), 2) .as("latitudeDifference"), pow(multiply(subtract(field("lng"), googleplexLng), 111), 2) .as("longitudeDifference")) .select( sqrt(add(field("latitudeDifference"), field("longitudeDifference"))) // Inaccurate for large distances or close to poles .as("approximateDistanceToGoogle")) .execute() .get();
Go
googleplexLat := 37.4221 googleplexLng := -122.0853 snapshot := client.Pipeline(). Collection("cities"). AddFields(firestore.Selectables( firestore.Pow(firestore.Multiply(firestore.Subtract(firestore.FieldOf("lat"), googleplexLat), 111), 2).As("latitudeDifference"), firestore.Pow(firestore.Multiply(firestore.Subtract(firestore.FieldOf("lng"), googleplexLng), 111), 2).As("longitudeDifference"), )). Select(firestore.Fields( firestore.Sqrt(firestore.Add(firestore.FieldOf("latitudeDifference"), firestore.FieldOf("longitudeDifference"))). // Inaccurate for large distances or close to poles As("approximateDistanceToGoogle"), )). Execute(ctx)
EXP
সিনট্যাক্স:
exp(exponent: FLOAT64) -> FLOAT64
বিবরণ:
exponent-এর পাওয়ারে উন্নীত অয়লারের সংখ্যার মান দেখায়, একে
ন্যাচারাল এক্সপোনেনশিয়াল ফাংশনও বলা হয়।
উদাহরণ:
| ঘাত | exp(exponent) |
|---|---|
| 0.0 | 1.0 |
| 10 | e^10 (FLOAT64) |
NaN |
NaN |
+inf |
+inf |
-inf |
0 |
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").exp().as("expRating")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("rating").exp().as("expRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").exp().as("expRating")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("rating").exp().alias("expRating")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").exp().alias("expRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").exp().as_("expRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(exp(field("rating")).as("expRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Exp(firestore.FieldOf("rating")).As("expRating"), )). Execute(ctx)
LN
সিনট্যাক্স:
ln(number: FLOAT64) -> FLOAT64
বিবরণ:
number-এর স্বাভাবিক লগারিদম দেখায়। এই ফাংশনটি
log(number)-এর সমতুল্য।
উদাহরণ:
| নম্বর | ln(number) |
|---|---|
| 1 | 0.0 |
| 2L | 0.693... |
| 1.0 | 0.0 |
e (FLOAT64) |
1.0 |
NaN |
NaN |
-inf |
NaN |
+inf |
+inf |
x <= 0 |
[error] |
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").ln().as("lnRating")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("rating").ln().as("lnRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").ln().as("lnRating")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("rating").ln().alias("lnRating")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").ln().alias("lnRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").ln().as_("lnRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(ln(field("rating")).as("lnRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Ln(firestore.FieldOf("rating")).As("lnRating"), )). Execute(ctx)
লগ
সিনট্যাক্স:
log(number: FLOAT64, base: FLOAT64) -> FLOAT64
log(number: FLOAT64) -> FLOAT64
বিবরণ:
base-এর number-এর লগারিদম দেখায়।
- শুধুমাত্র
numberপ্রদান করা হলে,number-এর লগারিদমbase-এ ফেরত দেয় (ln(number)-এর সমার্থক)।
উদাহরণ:
| নম্বর | বেস | log(number, base) |
|---|---|---|
| ১০০ | 10 | 2.0 |
NaN |
Numeric |
NaN |
Numeric |
NaN |
NaN |
-inf |
Numeric |
NaN |
Numeric। |
+inf |
NaN |
number <= 0 |
Numeric |
[error] |
Numeric |
base <= 0 |
[error] |
Numeric |
1.0 | [error] |
LOG10
সিনট্যাক্স:
log10(x: FLOAT64) -> FLOAT64
বিবরণ:
10 বেসের সাপেক্ষে number-এর লগারিদম দেখায়।
উদাহরণ:
| নম্বর | log10(number) |
|---|---|
| ১০০ | 2.0 |
NaN |
NaN |
-inf |
NaN |
+inf |
+inf |
x <= 0 |
[error] |
র্যান্ড
সিনট্যাক্স:
rand() -> FLOAT64
বিবরণ:
0.0 (অন্তর্ভুক্ত) এবং 1.0 (বাদ দিয়ে)-এর মধ্যে থেকে অভিন্নভাবে বেছে নেওয়া একটি সিউডো-র্যান্ডম ফ্লোটিং পয়েন্ট নম্বর রিটার্ন করে।
অ্যারে ফাংশন
| নাম | বিবরণ |
ARRAY
|
প্রতিটি ইনপুট আর্গুমেন্টের জন্য একটি এলিমেন্ট সহ ARRAY রিটার্ন করে
|
ARRAY_CONCAT
|
একাধিক অ্যারে একটি ARRAY-এ কনক্যাটিনেট করে
|
ARRAY_CONTAINS
|
প্রদত্ত ARRAY-এ নির্দিষ্ট ভ্যালু থাকলে TRUE রিটার্ন করে
|
ARRAY_CONTAINS_ALL
|
ARRAY-এ সব ভ্যালু থাকলে TRUE রিটার্ন করে
|
ARRAY_CONTAINS_ANY
|
ARRAY-এ কোনও ভ্যালু থাকলে TRUE রিটার্ন করে
|
ARRAY_FILTER
|
ARRAY থেকে এমন এলিমেন্ট ফিল্টার করে বাদ দেয় যা প্রেডিকেট পূরণ করে না
|
ARRAY_FIRST
|
ARRAY-এর প্রথম এলিমেন্ট ফেরত পাঠায়
|
ARRAY_FIRST_N
|
ARRAY-এ প্রথম nটি এলিমেন্ট দেখায়
|
ARRAY_GET
|
ARRAY-এ প্রদত্ত ইন্ডেক্সে এলিমেন্ট রিটার্ন করে
|
ARRAY_INDEX_OF
|
ARRAY-এ কোনও ভ্যালুর প্রথম উপস্থিতির ইন্ডেক্স দেখায়
|
ARRAY_INDEX_OF_ALL
|
ARRAY-এ কোনও ভ্যালুর সব ইন্ডেক্স দেখায়
|
ARRAY_LENGTH
|
ARRAY-এ এলিমেন্টের সংখ্যা দেখায়
|
ARRAY_LAST
|
ARRAY-এর শেষ এলিমেন্ট রিটার্ন করে
|
ARRAY_LAST_N
|
ARRAY-এ শেষ nটি এলিমেন্ট দেখায়
|
ARRAY_REVERSE
|
ARRAY-এ এলিমেন্টের ক্রম উল্টে দেয়
|
ARRAY_SLICE
|
ARRAY-এর একটি স্লাইস দেখায়
|
ARRAY_TRANSFORM
|
প্রতিটি এলিমেন্টে এক্সপ্রেশন প্রয়োগ করে ARRAY-এর এলিমেন্ট ট্রান্সফর্ম করে
|
MAXIMUM
|
ARRAY-এ সর্বাধিক মান দেখায়
|
MAXIMUM_N
|
ARRAY-এ n-টি সবচেয়ে বড় ভ্যালু দেখায়
|
MINIMUM
|
ARRAY-এ সর্বনিম্ন মান দেখায়
|
MINIMUM_N
|
ARRAY-এ nটি সবচেয়ে ছোট মান দেখায়
|
SUM
|
ARRAY-এ সব NUMERIC ভ্যালুর যোগফল দেখায়।
|
JOIN
|
ARRAY-এর মধ্যে থাকা এলিমেন্টকে STRING ভ্যালু হিসেবে কনক্যাটিনেট করে।
|
অ্যারে
সিনট্যাক্স:
array(values: ANY...) -> ARRAY
বিবরণ:
প্রদত্ত উপাদান থেকে একটি অ্যারে তৈরি করে।
- কোনও আর্গুমেন্ট না থাকলে, ফলাফল অ্যারেতে এটি
NULLদিয়ে প্রতিস্থাপিত হয়।
উদাহরণ:
| মান | array(values) |
|---|---|
| () | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
| (১, ২, ৩) | [১, ২, ৩] |
| ("a", 1, true) | ["a", 1, true] |
| (১, null) | [১, ফাঁকা] |
| (১, [২, ৩]) | [১, [২, ৩]] |
ARRAY_CONCAT
সিনট্যাক্স:
array_concat(arrays: ARRAY...) -> ARRAY
বিবরণ:
দুই বা তার বেশি অ্যারে একটি ARRAY-এ কনক্যাটিনেট করে।
উদাহরণ:
| অ্যারে | array_concat(arrays) |
|---|---|
| ([১, ২], [৩, ৪]) | [১, ২, ৩, ৪] |
| (["a", "b"], ["c"]) | ["a", "b", "c"] |
| ([১], [২], [৩]) | [১, ২, ৩] |
| ([], [১, ২]) | [১, ২] |
Node.js
const result = await db.pipeline() .collection("books") .select(field("genre").arrayConcat([field("subGenre")]).as("allGenres")) .execute();
Swift
let result = try await db.pipeline() .collection("books") .select([Field("genre").arrayConcat([Field("subGenre")]).as("allGenres")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("genre").arrayConcat(field("subGenre")).alias("allGenres")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("genre").arrayConcat(field("subGenre")).alias("allGenres")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("genre").array_concat(Field.of("subGenre")).as_("allGenres")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(arrayConcat(field("genre"), field("subGenre")).as("allGenres")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayConcat(firestore.FieldOf("genre"), firestore.FieldOf("subGenre")).As("allGenres"), )). Execute(ctx)
ARRAY_CONTAINS
সিনট্যাক্স:
array_contains(array: ARRAY, value: ANY) -> BOOLEAN
বিবরণ:
array-এ value পাওয়া গেলে TRUE দেখায়, অন্যথায় FALSE দেখায়।
উদাহরণ:
| অ্যারে | মান | array_contains(array, value) |
|---|---|---|
| [১, ২, ৩] | 2 | সত্য |
| [[১, ২], [৩]] | [১, ২] | সত্য |
| [১, ফাঁকা] | ফাঁকা | সত্য |
| "abc" | যে কোনো | ত্রুটি |
Node.js
const result = await db.pipeline() .collection("books") .select(field("genre").arrayContains(constant("mystery")).as("isMystery")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("genre").arrayContains(constant("mystery")).as("isMystery")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("genre").arrayContains(Constant("mystery")).as("isMystery")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("genre").arrayContains("mystery").alias("isMystery")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("genre").arrayContains("mystery").alias("isMystery")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("genre").array_contains("mystery").as_("isMystery")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(arrayContains(field("genre"), "mystery").as("isMystery")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayContains(firestore.FieldOf("genre"), "mystery").As("isMystery"), )). Execute(ctx)
ARRAY_CONTAINS_ALL
সিনট্যাক্স:
array_contains_all(array: ARRAY, search_values: ARRAY) -> BOOLEAN
বিবরণ:
array-এ সব search_values পাওয়া গেলে TRUE দেখায়, অন্যথায় FALSE দেখায়।
উদাহরণ:
| অ্যারে | search_values | array_contains_all(array, search_values) |
|---|---|---|
| [১, ২, ৩] | [১, ২] | সত্য |
| [১, ২, ৩] | [১, ৪] | মিথ্যা |
| [১, ফাঁকা] | [null] | সত্য |
| [NaN] | [NaN] | সত্য |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | সত্য |
| [১, ২, ৩] | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | সত্য |
Node.js
const result = await db.pipeline() .collection("books") .select( field("genre") .arrayContainsAll([constant("fantasy"), constant("adventure")]) .as("isFantasyAdventure") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("genre") .arrayContainsAll([constant("fantasy"), constant("adventure")]) .as("isFantasyAdventure") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("genre") .arrayContainsAll([Constant("fantasy"), Constant("adventure")]) .as("isFantasyAdventure") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("genre") .arrayContainsAll(listOf("fantasy", "adventure")) .alias("isFantasyAdventure") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("genre") .arrayContainsAll(Arrays.asList("fantasy", "adventure")) .alias("isFantasyAdventure") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("genre") .array_contains_all(["fantasy", "adventure"]) .as_("isFantasyAdventure") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( arrayContainsAll(field("genre"), Arrays.asList("fantasy", "adventure")) .as("isFantasyAdventure")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayContainsAll(firestore.FieldOf("genre"), []string{"fantasy", "adventure"}).As("isFantasyAdventure"), )). Execute(ctx)
ARRAY_CONTAINS_ANY
সিনট্যাক্স:
array_contains_any(array: ARRAY, search_values: ARRAY) -> BOOLEAN
বিবরণ:
array-এ search_values-এর কোনও একটি পাওয়া গেলে TRUE ফেরত পাঠায়, অন্যথায় FALSE ফেরত পাঠায়।
উদাহরণ:
| অ্যারে | search_values | array_contains_any(array, search_values) |
|---|---|---|
| [১, ২, ৩] | [৪, ১] | সত্য |
| [১, ২, ৩] | [৪, ৫] | মিথ্যা |
| [১, ২, ফাঁকা] | [null] | সত্য |
Node.js
const result = await db.pipeline() .collection("books") .select( field("genre") .arrayContainsAny([constant("fantasy"), constant("nonfiction")]) .as("isMysteryOrFantasy") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("genre") .arrayContainsAny([constant("fantasy"), constant("nonfiction")]) .as("isMysteryOrFantasy") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("genre") .arrayContainsAny([Constant("fantasy"), Constant("nonfiction")]) .as("isMysteryOrFantasy") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("genre") .arrayContainsAny(listOf("fantasy", "nonfiction")) .alias("isMysteryOrFantasy") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("genre") .arrayContainsAny(Arrays.asList("fantasy", "nonfiction")) .alias("isMysteryOrFantasy") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("genre") .array_contains_any(["fantasy", "nonfiction"]) .as_("isMysteryOrFantasy") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( arrayContainsAny(field("genre"), Arrays.asList("fantasy", "nonfiction")) .as("isMysteryOrFantasy")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayContainsAny(firestore.FieldOf("genre"), []string{"fantasy", "nonfiction"}).As("isMysteryOrFantasy"), )). Execute(ctx)
ARRAY_FILTER
সিনট্যাক্স:
array_filter(array: ARRAY, predicate: (ANY) -> BOOLEAN) -> ARRAY
বিবরণ:
predicate এক্সপ্রেশন ব্যবহার করে array ফিল্টার করে, শুধুমাত্র প্রেডিকেট পূরণ করে এমন এলিমেন্ট সহ একটি নতুন অ্যারে রিটার্ন করে।
array-এর প্রতিটি এলিমেন্টের জন্য,predicate-এর মান নির্ণয় করা হয়। এটিtrueরিটার্ন করলে, এলিমেন্টটি ফলাফলে অন্তর্ভুক্ত করা হয়; অন্যথায় (এটিfalseবাnullরিটার্ন করলে), এটি বাদ দেওয়া হয়।predicate-এর মূল্যায়ন নন-বুলিয়ান বা নন-নাল ভ্যালু হিসেবে করা হলে, ফাংশনটি একটি ত্রুটি দেখায়।
উদাহরণ:
| অ্যারে | বিধেয় | array_filter(array, predicate) |
|---|---|---|
| [১, ২, ৩] | x -> x > 1 | [২, ৩] |
| [১, null, ৩] | x -> x > 1 | [৩] |
| ["a", "b", "c"] | x -> x != "b" | ["a", "c"] |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | x -> true | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
ARRAY_GET
সিনট্যাক্স:
array_get(array: ARRAY, index: INT64) -> ANY
বিবরণ:
array-এ 0-ভিত্তিক index-এ এলিমেন্ট ফিরিয়ে দেয়।
indexনেগেটিভ হলে, অ্যারের শেষ থেকে এলিমেন্ট অ্যাক্সেস করা হয়, যেখানে-1হল শেষ এলিমেন্ট।arrayযদিARRAYধরনের না হয় এবংnullনা হয়, তাহলে সমস্যা দেখায়।indexসীমার বাইরে থাকলে, ফাংশনটি একটি অনুপস্থিত মান দেখায়।indexযদিINT64ধরনের না হয়, তাহলে ফাংশনটি একটি সমস্যা দেখায়।
উদাহরণ:
| অ্যারে | ইনডেক্স | array_get(array, index) |
|---|---|---|
| [১, ২, ৩] | 0 | 1 |
| [১, ২, ৩] | -১ | 3 |
| [১, ২, ৩] | 3 | অনুপস্থিত |
| [১, ২, ৩] | -4 | অনুপস্থিত |
| "abc" | 0 | ত্রুটি |
| ফাঁকা | 0 | ফাঁকা |
Array |
"a" | ত্রুটি |
Array |
2.0 | ত্রুটি |
ARRAY_LENGTH
সিনট্যাক্স:
array_length(array: ARRAY) -> INT64
বিবরণ:
array-এ এলিমেন্টের সংখ্যা দেখায়।
উদাহরণ:
| অ্যারে | array_length(array) |
|---|---|
| [১, ২, ৩] | 3 |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | 0 |
| [১, ১, ১] | 3 |
| [১, ফাঁকা] | 2 |
Node.js
const result = await db.pipeline() .collection("books") .select(field("genre").arrayLength().as("genreCount")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("genre").arrayLength().as("genreCount")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("genre").arrayLength().as("genreCount")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("genre").arrayLength().alias("genreCount")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("genre").arrayLength().alias("genreCount")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("genre").array_length().as_("genreCount")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(arrayLength(field("genre")).as("genreCount")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayLength(firestore.FieldOf("genre")).As("genreCount"), )). Execute(ctx)
ARRAY_REVERSE
সিনট্যাক্স:
array_reverse(array: ARRAY) -> ARRAY
বিবরণ:
প্রদত্ত array-এর বিপরীত মান দেখায়।
উদাহরণ:
| অ্যারে | array_reverse(array) |
|---|---|
| [১, ২, ৩] | [৩, ২, ১] |
| "one" | ["b", "a"] |
| [1, 2, 2, 3] | [3, 2, 2, 1] |
Node.js
const result = await db.pipeline() .collection("books") .select(arrayReverse(field("genre")).as("reversedGenres")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("genre").arrayReverse().as("reversedGenres")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("genre").arrayReverse().as("reversedGenres")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("genre").arrayReverse().alias("reversedGenres")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("genre").arrayReverse().alias("reversedGenres")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("genre").array_reverse().as_("reversedGenres")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(arrayReverse(field("genre")).as("reversedGenres")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayReverse(firestore.FieldOf("genre")).As("reversedGenres"), )). Execute(ctx)
ARRAY_FIRST
সিনট্যাক্স:
array_first(array: ARRAY) -> ANY
বিবরণ:
array-এর প্রথম এলিমেন্ট দেখায়। এটি array_get(array, 0)-এর সমতুল্য।
arrayখালি থাকলে, অনুপস্থিত ভ্যালু দেখায়।
উদাহরণ:
| অ্যারে | array_first(array) |
|---|---|
| [১, ২, ৩] | 1 |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | অনুপস্থিত |
ARRAY_FIRST_N
সিনট্যাক্স:
array_first_n(array: ARRAY, n: INT64) -> ARRAY
বিবরণ:
array-এর প্রথম nটি এলিমেন্ট রিটার্ন করে। এটি array_slice(array, 0, n)-এর সমতুল্য।
nনেগেটিভ হলে, সমস্যা পাওয়া গেছে।
উদাহরণ:
| অ্যারে | n | array_first_n(array, n) |
|---|---|---|
| [১, ২, ৩, ৪, ৫] | 3 | [১, ২, ৩] |
| [১, ২] | 3 | [১, ২] |
| [১, ২, ৩] | 0 | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
ARRAY_INDEX_OF
সিনট্যাক্স:
array_index_of(array: ARRAY, value: ANY) -> INT64
বিবরণ:
array-এ value-এর প্রথম ঘটনার ০-ভিত্তিক ইন্ডেক্স ফিরিয়ে দেয়। value খুঁজে না পাওয়া গেলে -১ রিটার্ন করে।
উদাহরণ:
| অ্যারে | মান | array_index_of(array, value) |
|---|---|---|
| [১, ২, ৩, ২] | 2 | 1 |
| [১, ২, ৩] | 4 | -১ |
| [১, null, ৩] | ফাঁকা | 1 |
ARRAY_INDEX_OF_ALL
সিনট্যাক্স:
array_index_of_all(array: ARRAY, value: ANY) -> ARRAY<INT64>
বিবরণ:
array-এ value-এর সব ঘটনার ০-ভিত্তিক ইন্ডেক্স সহ অ্যারে দেখায়। value খুঁজে না পাওয়া গেলে [] দেখায়।
উদাহরণ:
| অ্যারে | মান | array_index_of_all(array, value) |
|---|---|---|
| [১, ২, ৩, ২] | 2 | [১, ৩] |
| [১, ২, ৩] | 4 | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
| [১, null, ৩, null] | ফাঁকা | [১, ৩] |
ARRAY_LAST
সিনট্যাক্স:
array_last(array: ARRAY) -> ANY
বিবরণ:
array-এর শেষ এলিমেন্ট দেখায়। এটি array_get(array, -1)-এর সমতুল্য।
arrayখালি থাকলে, অনুপস্থিত ভ্যালু দেখায়।
উদাহরণ:
| অ্যারে | array_last(array) |
|---|---|
| [১, ২, ৩] | 3 |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | অনুপস্থিত |
ARRAY_LAST_N
সিনট্যাক্স:
array_last_n(array: ARRAY, n: INT64) -> ARRAY
বিবরণ:
array-এর শেষ nটি এলিমেন্ট দেখায়।
nনেগেটিভ হলে, সমস্যা পাওয়া গেছে।
উদাহরণ:
| অ্যারে | n | array_last_n(array, n) |
|---|---|---|
| [১, ২, ৩, ৪, ৫] | 3 | [৩, ৪, ৫] |
| [১, ২] | 3 | [১, ২] |
| [১, ২, ৩] | 0 | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
ARRAY_SLICE
সিনট্যাক্স:
array_slice(array: ARRAY, offset: INT64, length: INT64) -> ARRAY
বিবরণ:
০-ভিত্তিক ইন্ডেক্স offset থেকে শুরু করে এবং length এলিমেন্ট সহ array-এর একটি সাবসেট ফিরিয়ে দেয়।
offsetনেগেটিভ হলে, এটি অ্যারের শেষ থেকে শুরুর পজিশন নির্দেশ করে, যেখানে-1হল শেষ এলিমেন্ট।offset-এর পরে অ্যারেতে বাকি থাকা এলিমেন্টের সংখ্যার চেয়েlengthবেশি হলে, ফলাফল অ্যারের শেষ পর্যন্ত বিস্তৃত হয়।lengthঅবশ্যই নেগেটিভ নয় এমন সংখ্যা হতে হবে, অন্যথায় সমস্যা পাওয়া গেছে।
উদাহরণ:
| অ্যারে | অফসেট | দৈর্ঘ্য | array_slice(array, offset, length) |
|---|---|---|---|
| [১, ২, ৩, ৪, ৫] | 1 | 3 | [২, ৩, ৪] |
| [১, ২, ৩, ৪, ৫] | -২ | 2 | [৪, ৫] |
| [১, ২, ৩] | 1 | 5 | [২, ৩] |
| [১, ২, ৩] | 3 | 2 | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
ARRAY_TRANSFORM
সিনট্যাক্স:
array_transform(array: ARRAY, expression: (ANY) -> ANY) -> ARRAY
array_transform(array: ARRAY, expression: (ANY, INT64) -> ANY) -> ARRAY
বিবরণ:
প্রতিটি এলিমেন্টে expression প্রয়োগ করে array ট্রান্সফর্ম করে, ট্রান্সফর্ম করা এলিমেন্ট সহ নতুন অ্যারে রিটার্ন করে। আউটপুট অ্যারের সাইজ সবসময় ইনপুট অ্যারের সাইজের সমান হবে।
expressionএকটি ইউনারি ফাংশনelement -> result, বা একটি বাইনারি ফাংশন(element, index) -> resultহতে পারে।expressionইউনারি হলে, এটিarray-এর প্রতিটি এলিমেন্টের সাথে কল করা হয়।expressionবাইনারি হলে, এটিarray-এর প্রতিটি এলিমেন্ট এবং এর সাথে সম্পর্কিত ০-ভিত্তিক ইন্ডেক্সের সাথে কল করা হয়।
উদাহরণ:
| অ্যারে | এক্সপ্রেশন | array_transform(array, expression) |
|---|---|---|
| [১, ২, ৩] | x -> x * ২ | [২, ৪, ৬] |
| [১, ২, ৩] | x -> x + 1 | [২, ৩, ৪] |
| [১০, ২০] | (x, i) -> x + i | [১০, ২১] |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | x -> ১ | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
সর্বাধিক
সিনট্যাক্স:
maximum(array: ARRAY) -> ANY
বিবরণ:
array-এ সর্বাধিক মান দেখায়।
- তুলনা করার সময়
NULLভ্যালু উপেক্ষা করা হয়। arrayখালি থাকলে বা শুধুমাত্রNULLভ্যালু থাকলে,NULLদেখায়।
উদাহরণ:
| অ্যারে | maximum(array) |
|---|---|
| [১, ৫, ২] | 5 |
| [1, null, 5] | 5 |
| ["a", "c", "b"] | "c" |
| [null, null] | ফাঁকা |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | ফাঁকা |
MAXIMUM_N
সিনট্যাক্স:
maximum_n(array: ARRAY, n: INT64) -> ARRAY
বিবরণ:
array-এ n-এর সবচেয়ে বড় ভ্যালুর অ্যারে নিম্নক্রমে দেখায়।
NULLভ্যালু এড়িয়ে যাওয়া হয়েছে।nনেগেটিভ হলে, সমস্যা পাওয়া গেছে।
উদাহরণ:
| অ্যারে | n | maximum_n(array, n) |
|---|---|---|
| [১, ৫, ২, ৪, ৩] | 3 | [৫, ৪, ৩] |
| [1, null, 5] | 3 | [৫, ১] |
ন্যূনতম
সিনট্যাক্স:
minimum(array: ARRAY) -> ANY
বিবরণ:
array-এ সর্বনিম্ন মান দেখায়।
- তুলনা করার সময়
NULLভ্যালু উপেক্ষা করা হয়। arrayখালি থাকলে বা শুধুমাত্রNULLভ্যালু থাকলে,NULLদেখায়।
উদাহরণ:
| অ্যারে | minimum(array) |
|---|---|
| [১, ৫, ২] | 1 |
| [৫, null, ১] | 1 |
| ["a", "c", "b"] | "a" |
| [null, null] | ফাঁকা |
| [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] | ফাঁকা |
MINIMUM_N
সিনট্যাক্স:
minimum_n(array: ARRAY, n: INT64) -> ARRAY
বিবরণ:
array-এর মধ্যে n-টি সবচেয়ে ছোট ভ্যালুর অ্যারে ঊর্ধ্বক্রমে দেখায়।
NULLভ্যালু এড়িয়ে যাওয়া হয়েছে।nনেগেটিভ হলে, সমস্যা পাওয়া গেছে।
উদাহরণ:
| অ্যারে | n | minimum_n(array, n) |
|---|---|---|
| [১, ৫, ২, ৪, ৩] | 3 | [১, ২, ৩] |
| [৫, null, ১] | 3 | [১, ৫] |
SUM
সিনট্যাক্স:
sum(array: ARRAY) -> INT64 | FLOAT64
বিবরণ:
ARRAY-এ সব NUMERIC ভ্যালুর যোগফল দেখায়।
- অ্যারেতে সংখ্যাসূচক নয় এমন মান উপেক্ষা করা হয়।
- অ্যারেতে কোনও সংখ্যাসূচক মান
NaNহলে, ফাংশনNaNরিটার্ন করে। - অ্যারেতে সবচেয়ে বড় সংখ্যাসূচক ধরন অনুযায়ী রিটার্ন টাইপ নির্ধারণ করা হয়:
INT64<FLOAT64। - কোনও ফ্লোটিং পয়েন্ট ভ্যালু যোগ করার আগে ৬৪-বিট ইন্টিজার ওভারফ্লো হলে, একটি সমস্যা দেখানো হয়। ফ্লোটিং পয়েন্ট ভ্যালু যোগ করা হলে, ওভারফ্লোর ফলাফল +/- ইনফিনিটি হবে।
- অ্যারেতে কোনও সংখ্যাসূচক মান না থাকলে, ফাংশনটি
NULLরিটার্ন করে।
উদাহরণ:
| অ্যারে | sum(array) |
|---|---|
| [১, ২, ৩] | ৬ লিটার |
| [1L, 2L, 3L] | ৬ লিটার |
| [2000000000, 2000000000] | 4000000000L |
| [১০, ২০.৫] | ৩০.৫ |
| [1, "a", 2] | ৩ লাখ |
| [INT64.MAX_VALUE, 1] | ত্রুটি |
| [INT64.MAX_VALUE, 1, -1.0] | ত্রুটি |
| [INT64.MAX_VALUE, 1.0] | 9.223372036854776e+18 |
যোগদান করুন
সিনট্যাক্স:
join[T <: STRING | BYTES](array: ARRAY<T>, delimiter: T) -> STRING
join[T <: STRING | BYTES](array: ARRAY<T>, delimiter: T, null_text: T) -> STRING
বিবরণ:
array-এ থাকা এলিমেন্টকে STRING হিসেবে কনক্যাটিনেট করে দেখায়। array-এর ডেটা টাইপ STRING বা BYTES হতে পারে।
array,delimiterএবংnull_text-এর সব এলিমেন্ট একই ধরনের হতে হবে; সেগুলি সবSTRINGবা সবBYTESহতে হবে।null_textপ্রদান করা হলে,array-এ যেকোনওNULLভ্যালুnull_textদিয়ে পরিবর্তন করা হয়।null_textপ্রদান করা না হলে,array-এNULLভ্যালু ফলাফল থেকে বাদ দেওয়া হয়।
উদাহরণ:
null_text উল্লেখ না করা থাকলে:
| অ্যারে | ডিলিমিটার | join(array, delimiter) |
|---|---|---|
| ["a", "b", "c"] | "," | "a,b,c" |
| ["a", null, "c"] | "," | "a,c" |
| [b'a', b'b', b'c'] | b',' | b'a,b,c' |
| ["a", b'c'] | "," | ত্রুটি |
| ["a", "c"] | b',' | ত্রুটি |
| [b'a', b'c'] | "," | ত্রুটি |
null_text প্রদান করা হলে:
| অ্যারে | ডিলিমিটার | null_text | join(array, delimiter, null_text) |
|---|---|---|---|
| ["a", null, "c"] | "," | "MISSING" | "a,MISSING,c" |
| [b'a', null, b'c'] | b',' | b'NULL' | b'a,NULL,c' |
| [null, "b", null] | "," | "MISSING" | "MISSING,b,MISSING" |
| [b'a', null, null] | b',' | b'NULL' | b'a,NULL,NULL' |
| ["a", null] | "," | b'N' | ত্রুটি |
| [b'a', null] | b',' | "N" | ত্রুটি |
তুলনা করার ফাংশন
| নাম | বিবরণ |
EQUAL
|
সমতার তুলনা |
GREATER_THAN
|
তুলনার থেকে বেশি |
GREATER_THAN_OR_EQUAL
|
এর থেকে বড় বা এর সমান তুলনা |
LESS_THAN
|
তুলনার থেকে কম |
LESS_THAN_OR_EQUAL
|
এর থেকে কম বা সমান তুলনা |
NOT_EQUAL
|
সমান নয় তুলনা |
CMP
|
সাধারণ তুলনা |
সমান
সিনট্যাক্স:
equal(x: ANY, y: ANY) -> BOOLEAN
উদাহরণ:
x |
y |
equal(x, y) |
|---|---|---|
| ১ লিটার | ১ লিটার | TRUE |
| 1.0 | ১ লিটার | TRUE |
| -১.০ | ১ লিটার | FALSE |
| NaN | NaN | TRUE |
NULL |
NULL |
TRUE |
NULL |
ABSENT |
FALSE |
বিবরণ:
x ও y সমান হলে TRUE রিটার্ন করে, অন্যথায় FALSE রিটার্ন করে।
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").equal(5).as("hasPerfectRating")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("rating").equal(5).as("hasPerfectRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").equal(5).as("hasPerfectRating")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("rating").equal(5).alias("hasPerfectRating")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").equal(5).alias("hasPerfectRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").equal(5).as_("hasPerfectRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(equal(field("rating"), 5).as("hasPerfectRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Equal(firestore.FieldOf("rating"), 5).As("hasPerfectRating"), )). Execute(ctx)
GREATER_THAN
সিনট্যাক্স:
greater_than(x: ANY, y: ANY) -> BOOLEAN
বিবরণ:
x, y-এর থেকে বড় হলে TRUE রিটার্ন করে, অন্যথায় FALSE রিটার্ন করে।
x এবং y তুলনীয় না হলে, FALSE রিটার্ন করে।
উদাহরণ:
x |
y |
greater_than(x, y) |
|---|---|---|
| ১ লিটার | 0.0 | TRUE |
| ১ লিটার | ১ লিটার | FALSE |
| ১ লিটার | 2L | FALSE |
| "foo" | ০ লিটার | FALSE |
| ০ লিটার | "foo" | FALSE |
| NaN | ০ লিটার | FALSE |
| ০ লিটার | NaN | FALSE |
NULL |
NULL |
FALSE |
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").greaterThan(4).as("hasHighRating")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("rating").greaterThan(4).as("hasHighRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").greaterThan(4).as("hasHighRating")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("rating").greaterThan(4).alias("hasHighRating")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").greaterThan(4).alias("hasHighRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").greater_than(4).as_("hasHighRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(greaterThan(field("rating"), 4).as("hasHighRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.GreaterThan(firestore.FieldOf("rating"), 4).As("hasHighRating"), )). Execute(ctx)
GREATER_THAN_OR_EQUAL
সিনট্যাক্স:
greater_than_or_equal(x: ANY, y: ANY) -> BOOLEAN
বিবরণ:
x, y-এর থেকে বড় বা সমান হলে TRUE রিটার্ন করে, অন্যথায় FALSE রিটার্ন করে।
x এবং y তুলনীয় না হলে, FALSE রিটার্ন করে।
উদাহরণ:
x |
y |
greater_than_or_equal(x, y) |
|---|---|---|
| ১ লিটার | 0.0 | TRUE |
| ১ লিটার | ১ লিটার | TRUE |
| ১ লিটার | 2L | FALSE |
| "foo" | ০ লিটার | FALSE |
| ০ লিটার | "foo" | FALSE |
| NaN | ০ লিটার | FALSE |
| ০ লিটার | NaN | FALSE |
NULL |
NULL |
TRUE |
Node.js
const result = await db.pipeline() .collection("books") .select(field("published").greaterThanOrEqual(1900).as("publishedIn20thCentury")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("published").greaterThanOrEqual(1900).as("publishedIn20thCentury")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("published").greaterThanOrEqual(1900).as("publishedIn20thCentury")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("published").greaterThanOrEqual(1900).alias("publishedIn20thCentury")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("published").greaterThanOrEqual(1900).alias("publishedIn20thCentury")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("published") .greater_than_or_equal(1900) .as_("publishedIn20thCentury") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(greaterThanOrEqual(field("published"), 1900).as("publishedIn20thCentury")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.GreaterThanOrEqual(firestore.FieldOf("published"), 1900).As("publishedIn20thCentury"), )). Execute(ctx)
LESS_THAN
সিনট্যাক্স:
less_than(x: ANY, y: ANY) -> BOOLEAN
বিবরণ:
x, y-এর থেকে কম হলে TRUE এবং অন্যথায় FALSE দেখায়।
x এবং y তুলনীয় না হলে, FALSE রিটার্ন করে।
উদাহরণ:
x |
y |
less_than(x, y) |
|---|---|---|
| ১ লিটার | 0.0 | FALSE |
| ১ লিটার | ১ লিটার | FALSE |
| ১ লিটার | 2L | TRUE |
| "foo" | ০ লিটার | FALSE |
| ০ লিটার | "foo" | FALSE |
| NaN | ০ লিটার | FALSE |
| ০ লিটার | NaN | FALSE |
NULL |
NULL |
FALSE |
Node.js
const result = await db.pipeline() .collection("books") .select(field("published").lessThan(1923).as("isPublicDomainProbably")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("published").lessThan(1923).as("isPublicDomainProbably")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("published").lessThan(1923).as("isPublicDomainProbably")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("published").lessThan(1923).alias("isPublicDomainProbably")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("published").lessThan(1923).alias("isPublicDomainProbably")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("published").less_than(1923).as_("isPublicDomainProbably")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(lessThan(field("published"), 1923).as("isPublicDomainProbably")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.LessThan(firestore.FieldOf("published"), 1923).As("isPublicDomainProbably"), )). Execute(ctx)
LESS_THAN_OR_EQUAL
সিনট্যাক্স:
less_than_or_equal(x: ANY, y: ANY) -> BOOLEAN
বিবরণ:
x, y-এর থেকে ছোট বা সমান হলে TRUE এবং অন্যথায় FALSE রিটার্ন করে।
x এবং y তুলনীয় না হলে, FALSE রিটার্ন করে।
উদাহরণ:
x |
y |
less_than(x, y) |
|---|---|---|
| ১ লিটার | 0.0 | FALSE |
| ১ লিটার | ১ লিটার | TRUE |
| ১ লিটার | 2L | TRUE |
| "foo" | ০ লিটার | FALSE |
| ০ লিটার | "foo" | FALSE |
| NaN | ০ লিটার | FALSE |
| ০ লিটার | NaN | FALSE |
NULL |
NULL |
TRUE |
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").lessThanOrEqual(2).as("hasBadRating")) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select(field("rating").lessThanOrEqual(2).as("hasBadRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").lessThanOrEqual(2).as("hasBadRating")]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select(field("rating").lessThanOrEqual(2).alias("hasBadRating")) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").lessThanOrEqual(2).alias("hasBadRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").less_than_or_equal(2).as_("hasBadRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(lessThanOrEqual(field("rating"), 2).as("hasBadRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.LessThanOrEqual(firestore.FieldOf("rating"), 2).As("hasBadRating"), )). Execute(ctx)
NOT_EQUAL
সিনট্যাক্স:
not_equal(x: ANY, y: ANY) -> BOOLEAN
বিবরণ:
x, y-এর সমান না হলে TRUE রিটার্ন করে, অন্যথায় FALSE রিটার্ন করে।
উদাহরণ:
x |
y |
not_equal(x, y) |
|---|---|---|
| ১ লিটার | ১ লিটার | FALSE |
| 1.0 | ১ লিটার | FALSE |
| -১.০ | ১ লিটার | TRUE |
| NaN | ০ লিটার | TRUE |
| NaN | NaN | FALSE |
NULL |
NULL |
FALSE |
NULL |
ABSENT |
TRUE |
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();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.NotEqual(firestore.FieldOf("title"), "1984").As("not1984"), )). Execute(ctx)
CMP
সিনট্যাক্স:
cmp(x: ANY, y: ANY) -> Int64
বিবরণ:
x ও y-এর মধ্যে তুলনা করে, রিটার্ন করে:
x,y-এর থেকে বড় হলে1L।x,y-এর থেকে কম হলে-1L।- অন্যথায়
0L।
অন্যান্য তুলনা ফাংশনের মতো নয়, cmp(...) ফাংশন বিভিন্ন ধরনের ডেটা নিয়ে কাজ করে,
sort(...) স্টেজে ব্যবহৃত একই ক্রম অনুসরণ করে। বিভিন্ন ধরনের ভ্যালু কীভাবে সাজানো হয় তা জানতে
ভ্যালুর ধরন অনুযায়ী ক্রম দেখুন।
উদাহরণ:
x |
y |
cmp(x, y) |
|---|---|---|
| ১ লিটার | ১ লিটার | ০ লিটার |
| 1.0 | ১ লিটার | ০ লিটার |
| -১.০ | ১ লিটার | -১ লিটার |
| ৪২.৫দিন | "foo" | -১ লিটার |
NULL |
NULL |
০ লিটার |
NULL |
ABSENT |
০ লিটার |
ডিবাগিং ফাংশন
| নাম | বিবরণ |
EXISTS
|
ভ্যালু অনুপস্থিত না থাকলে TRUE দেখায়
|
IS_ABSENT
|
ভ্যালু অনুপস্থিত থাকলে TRUE রিটার্ন করে
|
IF_ABSENT
|
ভ্যালু না থাকলে, এটি ভ্যালুকে এক্সপ্রেশন দিয়ে প্রতিস্থাপন করে |
IS_ERROR
|
অন্তর্নিহিত এক্সপ্রেশন কোনও সমস্যা থ্রো করেছে কিনা তা ক্যাচ ও চেক করে |
IF_ERROR
|
ভ্যালু কোনও সমস্যা তৈরি করলে, এটি ভ্যালুকে এক্সপ্রেশন দিয়ে প্রতিস্থাপন করে |
ERROR
|
মূল্যায়ন শেষ করে এবং নির্দিষ্ট মেসেজ সহ একটি ত্রুটি দেখায় |
আগে থেকেই আছে
সিনট্যাক্স:
exists(value: ANY) -> BOOLEAN
বিবরণ:
value অনুপস্থিত ভ্যালু না হলে TRUE রিটার্ন করে।
উদাহরণ:
value |
exists(value) |
|---|---|
| ০ লিটার | TRUE |
| "foo" | TRUE |
NULL |
TRUE |
ABSENT |
FALSE |
Node.js
const result = await db.pipeline() .collection("books") .select(field("rating").exists().as("hasRating")) .execute();
Web
উদাহরণ:
const result = await execute(db.pipeline() .collection("books") .select(field("rating").exists().as("hasRating")) );
Swift
let result = try await db.pipeline() .collection("books") .select([Field("rating").exists().as("hasRating")]) .execute()
Kotlin
উদাহরণ:
val result = db.pipeline() .collection("books") .select(field("rating").exists().alias("hasRating")) .execute()
Java
উদাহরণ:
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select(field("rating").exists().alias("hasRating")) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").exists().as_("hasRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(exists(field("rating")).as("hasRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.FieldExists(firestore.FieldOf("rating")).As("hasRating"), )). Execute(ctx)
IS_ABSENT
সিনট্যাক্স:
is_absent(value: ANY) -> BOOLEAN
বিবরণ:
value অনুপস্থিত ভ্যালু হলে TRUE রিটার্ন করে, অন্যথায় FALSE রিটার্ন করে। অনুপস্থিত মান
হল এমন মান যা ইনপুটে নেই, যেমন কোনও অনুপস্থিত ডকুমেন্ট ফিল্ড।
উদাহরণ:
value |
is_absent(value) |
|---|---|
| ০ লিটার | FALSE |
| "foo" | FALSE |
NULL |
FALSE |
ABSENT |
TRUE |
IF_ABSENT
সিনট্যাক্স:
if_absent(value: ANY, replacement: ANY) -> ANY
বিবরণ:
value-এর কোনও ভ্যালু না থাকলে, মূল্যায়ন করে replacement দেখায়। অন্যথায় value রিটার্ন করে।
উদাহরণ:
value |
replacement |
if_absent(value, replacement) |
|---|---|---|
| ৫ লাখ | ০ লিটার | ৫ লাখ |
NULL |
০ লিটার | NULL |
ABSENT |
০ লিটার | ০ লিটার |
IS_ERROR
সিনট্যাক্স:
is_error(try: ANY) -> BOOLEAN
বিবরণ:
try-এর মূল্যায়ন করার সময় কোনও সমস্যা হলে TRUE ফেরত পাঠায়। অন্যথায় FALSE রিটার্ন করে।
IF_ERROR
সিনট্যাক্স:
if_error(try: ANY, catch: ANY) -> ANY
বিবরণ:
try-এর মূল্যায়ন করার সময় কোনও সমস্যা হলে, মূল্যায়ন করে replacement ফেরত পাঠায়। অন্যথায় try-এর সমাধান করা ভ্যালু রিটার্ন করে।
সমস্যা
সিনট্যাক্স:
error(message: STRING) -> ANY
বিবরণ:
error ফাংশন মূল্যায়ন করার ফলে পাইপলাইন মূল্যায়ন করার সময় সমস্যা হয় এবং
সেটি বন্ধ হয়ে যায়। প্রদত্ত message-এ সমস্যা আছে।
উদাহরণ:
cond |
res |
switch_on(cond, res, error("no condition matched")) |
|---|---|---|
TRUE |
১ লিটার | ১ লিটার |
FALSE |
১ লিটার | ERROR ("no condition matched") |
রেফারেন্স ফাংশন
REFERENCE ধরনটি ডেটাবেসের (বা এমনকি অন্যান্য ডেটাবেসের) অন্যান্য ডকুমেন্টের "পয়েন্টার" হিসেবে কাজ করে। কোয়েরি এক্সিকিউশনের সময় নিম্নলিখিত ফাংশনগুলি এই ধরনের ডেটা
ম্যানিপুলেট করার অনুমতি দেয়।
| নাম | বিবরণ |
COLLECTION_ID
|
প্রদত্ত রেফারেন্সে লিফ কালেকশনের আইডি দেখায় |
DOCUMENT_ID
|
প্রদত্ত রেফারেন্সে ডকুমেন্টের আইডি দেখায় |
PARENT
|
প্যারেন্ট রেফারেন্স দেখায় |
REFERENCE_SLICE
|
প্রদত্ত রেফারেন্স থেকে সেগমেন্টের সাবসেট দেখায় |
COLLECTION_ID
সিনট্যাক্স:
collection_id(ref: REFERENCE) -> STRING
বিবরণ:
প্রদত্ত REFERENCE-এর লিফ কালেকশন আইডি দেখায়।
উদাহরণ:
ref |
collection_id(ref) |
|---|---|
users/user1 |
"users" |
users/user1/posts/post1 |
"posts" |
DOCUMENT_ID
সিনট্যাক্স:
document_id(ref: REFERENCE) -> ANY
বিবরণ:
প্রদত্ত REFERENCE-এর ডকুমেন্ট আইডি দেখায়।
উদাহরণ:
ref |
document_id(ref) |
|---|---|
users/user1 |
"user1" |
users/user1/posts/post1 |
"post1" |
অভিভাবক
সিনট্যাক্স:
parent(ref: REFERENCE) -> REFERENCE
বিবরণ:
প্রদত্ত রেফারেন্সের পেরেন্ট REFERENCE বা রেফারেন্সটি আগে থেকেই রুট রেফারেন্স হলে NULL প্রদান করে।
উদাহরণ:
ref |
parent(ref) |
|---|---|
/ |
NULL |
users/user1 |
/ |
users/user1/posts/post1 |
users/user1 |
REFERENCE_SLICE
সিনট্যাক্স:
reference_slice(ref: REFERENCE, offset: INT, length: INT) -> REFERENCE
বিবরণ:
REFERENCE হল (collection_id, document_id) টিউপলের একটি তালিকা এবং এটি
array_slice(...)-এর মতো সেই তালিকার একটি ভিউ পাওয়ার অনুমতি দেয়।
নতুন REFERENCE প্রদান করে যা প্রদত্ত ref-এর সেগমেন্টের সাবসেট।
offset: স্লাইসের শুরুর ইন্ডেক্স (০-ভিত্তিক)। নেগেটিভ হলে, এটি রেফারেন্সের শেষ থেকে অফসেট।length: স্লাইসে অন্তর্ভুক্ত করার জন্য সেগমেন্টের সংখ্যা।
উদাহরণ:
ref |
offset |
length |
reference_slice(ref, offset, length) |
|---|---|---|---|
a/1/b/2/c/3 |
১ লিটার | 2L | b/2/c/3 |
a/1/b/2/c/3 |
০ লিটার | 2L | a/1/b/2 |
a/1/b/2/c/3 |
-2L | 2L | c/3 |
লজিক্যাল ফাংশন
| নাম | বিবরণ |
AND
|
লজিকাল AND পারফর্ম করে |
OR
|
লজিকাল OR পারফর্ম করে |
XOR
|
লজিক্যাল XOR পারফর্ম করে |
NOT
|
লজিকাল NOT পারফর্ম করে |
NOR
|
লজিক্যাল NOR পারফর্ম করে |
CONDITIONAL
|
শর্তসাপেক্ষ এক্সপ্রেশনের উপর ভিত্তি করে ব্রাঞ্চ মূল্যায়ন। |
IF_NULL
|
প্রথম নন-নাল ভ্যালু দেখায় |
SWITCH_ON
|
একাধিক শর্তের উপর ভিত্তি করে ব্রাঞ্চ মূল্যায়ন |
EQUAL_ANY
|
কোনও ভ্যালু অ্যারের কোনও এলিমেন্টের সমান কিনা তা চেক করে |
NOT_EQUAL_ANY
|
কোনও ভ্যালু অ্যারের কোনও এলিমেন্টের সমান কিনা তা চেক করে |
MAXIMUM
|
মানগুলির একটি সেটের মধ্যে সর্বাধিক মান দেখায় |
MINIMUM
|
মানগুলির একটি সেটে সর্বনিম্ন মান দেখায় |
এবং
সিনট্যাক্স:
and(x: BOOLEAN...) -> BOOLEAN
বিবরণ:
দুই বা তার বেশি বুলিয়ান মানের লজিক্যাল AND দেখায়।
প্রদত্ত কোনও ভ্যালু ABSENT বা NULL হওয়ার কারণে ফলাফল পাওয়া না গেলে, NULL দেখায়।
উদাহরণ:
x |
y |
and(x, y) |
|---|---|---|
TRUE |
TRUE |
TRUE |
FALSE |
TRUE |
FALSE |
NULL |
TRUE |
NULL |
ABSENT |
TRUE |
NULL |
NULL |
FALSE |
FALSE |
FALSE |
ABSENT |
FALSE |
Node.js
const result = await db.pipeline() .collection("books") .select( and(field("rating").greaterThan(4), field("price").lessThan(10)) .as("under10Recommendation") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( and(field("rating").greaterThan(4), field("price").lessThan(10)) .as("under10Recommendation") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ (Field("rating").greaterThan(4) && Field("price").lessThan(10)) .as("under10Recommendation") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( Expression.and(field("rating").greaterThan(4), field("price").lessThan(10)) .alias("under10Recommendation") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( Expression.and( field("rating").greaterThan(4), field("price").lessThan(10) ).alias("under10Recommendation") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field, And result = ( client.pipeline() .collection("books") .select( And( Field.of("rating").greater_than(4), Field.of("price").less_than(10) ).as_("under10Recommendation") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( and(greaterThan(field("rating"), 4), lessThan(field("price"), 10)) .as("under10Recommendation")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.And( firestore.GreaterThan(firestore.FieldOf("rating"), 4), firestore.LessThan(firestore.FieldOf("price"), 10), ).As("under10Recommendation"), )). Execute(ctx)
অথবা
সিনট্যাক্স:
or(x: BOOLEAN...) -> BOOLEAN
বিবরণ:
দুই বা তার বেশি বুলিয়ান মানের লজিক্যাল OR দেখায়।
প্রদত্ত কোনও ভ্যালু ABSENT বা NULL হওয়ার কারণে ফলাফল পাওয়া না গেলে, NULL দেখায়।
উদাহরণ:
x |
y |
or(x, y) |
|---|---|---|
TRUE |
TRUE |
TRUE |
FALSE |
TRUE |
TRUE |
NULL |
TRUE |
TRUE |
ABSENT |
TRUE |
TRUE |
NULL |
FALSE |
NULL |
FALSE |
ABSENT |
NULL |
Node.js
const result = await db.pipeline() .collection("books") .select( or(field("genre").equal("Fantasy"), field("tags").arrayContains("adventure")) .as("matchesSearchFilters") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( or(field("genre").equal("Fantasy"), field("tags").arrayContains("adventure")) .as("matchesSearchFilters") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ (Field("genre").equal("Fantasy") || Field("tags").arrayContains("adventure")) .as("matchesSearchFilters") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( Expression.or(field("genre").equal("Fantasy"), field("tags").arrayContains("adventure")) .alias("matchesSearchFilters") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( Expression.or( field("genre").equal("Fantasy"), field("tags").arrayContains("adventure") ).alias("matchesSearchFilters") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field, And, Or result = ( client.pipeline() .collection("books") .select( Or( Field.of("genre").equal("Fantasy"), Field.of("tags").array_contains("adventure"), ).as_("matchesSearchFilters") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( or(equal(field("genre"), "Fantasy"), arrayContains(field("tags"), "adventure")) .as("matchesSearchFilters")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Or( firestore.Equal(firestore.FieldOf("genre"), "Fantasy"), firestore.ArrayContains(firestore.FieldOf("tags"), "adventure"), ).As("matchesSearchFilters"), )). Execute(ctx)
XOR
সিনট্যাক্স:
xor(x: BOOLEAN...) -> BOOLEAN
বিবরণ:
দুই বা তার বেশি বুলিয়ান মানের লজিক্যাল XOR দেখায়।
প্রদত্ত যেকোনও মান ABSENT বা NULL হলে NULL দেখায়।
উদাহরণ:
x |
y |
xor(x, y) |
|---|---|---|
TRUE |
TRUE |
FALSE |
FALSE |
FALSE |
FALSE |
FALSE |
TRUE |
TRUE |
NULL |
TRUE |
NULL |
ABSENT |
TRUE |
NULL |
NULL |
FALSE |
NULL |
FALSE |
ABSENT |
NULL |
Node.js
const result = await execute(db.pipeline() .collection("books") .select( xor(field("tags").arrayContains("magic"), field("tags").arrayContains("nonfiction")) .as("matchesSearchFilters") ) );
Web
const result = await execute(db.pipeline() .collection("books") .select( xor(field("tags").arrayContains("magic"), field("tags").arrayContains("nonfiction")) .as("matchesSearchFilters") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ (Field("tags").arrayContains("magic") ^ Field("tags").arrayContains("nonfiction")) .as("matchesSearchFilters") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( Expression.xor(field("tags").arrayContains("magic"), field("tags").arrayContains("nonfiction")) .alias("matchesSearchFilters") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( Expression.xor( field("tags").arrayContains("magic"), field("tags").arrayContains("nonfiction") ).alias("matchesSearchFilters") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field, Xor result = ( client.pipeline() .collection("books") .select( Xor( [ Field.of("tags").array_contains("magic"), Field.of("tags").array_contains("nonfiction"), ] ).as_("matchesSearchFilters") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( xor( arrayContains(field("tags"), "magic"), arrayContains(field("tags"), "nonfiction")) .as("matchesSearchFilters")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Xor( firestore.ArrayContains(firestore.FieldOf("tags"), "magic"), firestore.ArrayContains(firestore.FieldOf("tags"), "nonfiction"), ).As("matchesSearchFilters"), )). Execute(ctx)
NOR
সিনট্যাক্স:
nor(x: BOOLEAN...) -> BOOLEAN
বিবরণ:
দুটি বা তার বেশি বুলিয়ান মানের লজিক্যাল NOR দেখায়।
প্রদত্ত কোনও ভ্যালু ABSENT বা NULL হওয়ার কারণে ফলাফল পাওয়া না গেলে, NULL দেখায়।
উদাহরণ:
x |
y |
nor(x, y) |
|---|---|---|
TRUE |
TRUE |
FALSE |
FALSE |
TRUE |
FALSE |
FALSE |
FALSE |
TRUE |
NULL |
TRUE |
FALSE |
ABSENT |
TRUE |
FALSE |
NULL |
FALSE |
NULL |
FALSE |
ABSENT |
NULL |
NOT
সিনট্যাক্স:
not(x: BOOLEAN) -> BOOLEAN
বিবরণ:
বুলিয়ান মানের লজিক্যাল NOT দেখায়।
Node.js
const result = await execute(db.pipeline() .collection("books") .select( field("tags").arrayContains("nonfiction").not() .as("isFiction") ) );
Web
const result = await execute(db.pipeline() .collection("books") .select( field("tags").arrayContains("nonfiction").not() .as("isFiction") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ (!Field("tags").arrayContains("nonfiction")) .as("isFiction") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( Expression.not( field("tags").arrayContains("nonfiction") ).alias("isFiction") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( Expression.not( field("tags").arrayContains("nonfiction") ).alias("isFiction") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field, Not result = ( client.pipeline() .collection("books") .select(Not(Field.of("tags").array_contains("nonfiction")).as_("isFiction")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(not(arrayContains(field("tags"), "nonfiction")).as("isFiction")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Not(firestore.ArrayContains(firestore.FieldOf("tags"), "nonfiction")).As("isFiction"), )). Execute(ctx)
শর্তসাপেক্ষ
সিনট্যাক্স:
conditional(condition: BOOLEAN, true_case: ANY, false_case: ANY) -> ANY
বিবরণ:
condition-এর মূল্যায়ন TRUE হলে, true_case মূল্যায়ন করে ফেরত পাঠায়।
শর্তের সমাধান FALSE, NULL বা ABSENT ভ্যালু হলে, false_case মূল্যায়ন করে ফেরত পাঠায়।
উদাহরণ:
condition |
true_case |
false_case |
conditional(condition, true_case, false_case) |
|---|---|---|---|
TRUE |
১ লিটার | ০ লিটার | ১ লিটার |
FALSE |
১ লিটার | ০ লিটার | ০ লিটার |
NULL |
১ লিটার | ০ লিটার | ০ লিটার |
ABSENT |
১ লিটার | ০ লিটার | ০ লিটার |
Node.js
const result = await execute(db.pipeline() .collection("books") .select( field("tags").arrayConcat([ field("pages").greaterThan(100) .conditional(constant("longRead"), constant("shortRead")) ]).as("extendedTags") ) );
Web
const result = await execute(db.pipeline() .collection("books") .select( field("tags").arrayConcat([ field("pages").greaterThan(100) .conditional(constant("longRead"), constant("shortRead")) ]).as("extendedTags") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("tags").arrayConcat([ ConditionalExpression( Field("pages").greaterThan(100), then: Constant("longRead"), else: Constant("shortRead") ) ]).as("extendedTags") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("tags").arrayConcat( Expression.conditional( field("pages").greaterThan(100), constant("longRead"), constant("shortRead") ) ).alias("extendedTags") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("tags").arrayConcat( Expression.conditional( field("pages").greaterThan(100), constant("longRead"), constant("shortRead") ) ).alias("extendedTags") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import ( Field, Constant, Conditional, ) result = ( client.pipeline() .collection("books") .select( Field.of("tags") .array_concat( Conditional( Field.of("pages").greater_than(100), Constant.of("longRead"), Constant.of("shortRead"), ) ) .as_("extendedTags") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( arrayConcat( field("tags"), conditional( greaterThan(field("pages"), 100), constant("longRead"), constant("shortRead"))) .as("extendedTags")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ArrayConcat( firestore.FieldOf("tags"), firestore.Conditional( firestore.GreaterThan(firestore.FieldOf("pages"), 100), firestore.ConstantOf("longRead"), firestore.ConstantOf("shortRead"), ), ).As("extendedTags"), )). Execute(ctx)
IF_NULL
সিনট্যাক্স:
if_null(expr: ANY, replacement: ANY) -> ANY
বিবরণ:
NULL না হলে expr ফেরত পাঠায়, অন্যথায় মূল্যায়ন করে replacement ফেরত পাঠায়। expr ব্যবহার করা হলে replacement এক্সপ্রেশন মূল্যায়ন করা হয় না।
উদাহরণ:
expr |
replacement |
if_null(expr, replacement) |
|---|---|---|
| ১ লিটার | 2L | ১ লিটার |
NULL |
2L | 2L |
ABSENT |
2L | ABSENT |
SWITCH_ON
সিনট্যাক্স:
switch_on(cond1: BOOLEAN, res1: ANY, cond2: BOOLEAN, res2: ANY, ..., [default: ANY]) -> ANY
বিবরণ:
শর্তের একটি সিরিজ মূল্যায়ন করে এবং প্রথম TRUE শর্তের সাথে সম্পর্কিত ফলাফল
ফেরত পাঠায়। কোনও শর্ত TRUE হিসেবে মূল্যায়ন না করলে, default ভ্যালু
প্রদান করা থাকলে তা ফেরত দেওয়া হয়। default-এর কোনও ভ্যালু প্রদান করা না হলে, সমস্যা দেখা দেয়
যদি অন্য কোনও শর্ত TRUE-এ মূল্যায়ন করা না হয়।
default ভ্যালু প্রদান করতে, এটিকে চূড়ান্ত আর্গুমেন্ট হিসেবে পাস করুন যাতে
বিজোড় সংখ্যক আর্গুমেন্ট থাকে।
উদাহরণ:
x |
switch_on(eq(x, 1L), "one", eq(x, 2L), "two", "other") |
|---|---|
| ১ লিটার | "এক" |
| 2L | "দুটি" |
| ৩ লাখ | "অন্য" |
EQUAL_ANY
সিনট্যাক্স:
equal_any(value: ANY, search_space: ARRAY) -> BOOLEAN
বিবরণ:
value, search_space অ্যারেতে থাকলে TRUE রিটার্ন করে।
উদাহরণ:
value |
search_space |
equal_any(value, search_space) |
|---|---|---|
| ০ লিটার | [1L, 2L, 3L] | FALSE |
| 2L | [1L, 2L, 3L] | TRUE |
NULL |
[1L, 2L, 3L] | FALSE |
NULL |
[১ লিটার, NULL] |
TRUE |
ABSENT |
[১ লিটার, NULL] |
FALSE |
| NaN | [1L, NaN, 3L] | TRUE |
Node.js
const result = await execute(db.pipeline() .collection("books") .select( field("genre").equalAny(["Science Fiction", "Psychological Thriller"]) .as("matchesGenreFilters") ) );
Web
const result = await execute(db.pipeline() .collection("books") .select( field("genre").equalAny(["Science Fiction", "Psychological Thriller"]) .as("matchesGenreFilters") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("genre").equalAny(["Science Fiction", "Psychological Thriller"]) .as("matchesGenreFilters") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("genre").equalAny(listOf("Science Fiction", "Psychological Thriller")) .alias("matchesGenreFilters") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("genre").equalAny(Arrays.asList("Science Fiction", "Psychological Thriller")) .alias("matchesGenreFilters") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("genre") .equal_any(["Science Fiction", "Psychological Thriller"]) .as_("matchesGenreFilters") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( equalAny(field("genre"), Arrays.asList("Science Fiction", "Psychological Thriller")) .as("matchesGenreFilters")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.EqualAny(firestore.FieldOf("genre"), []string{"Science Fiction", "Psychological Thriller"}).As("matchesGenreFilters"), )). Execute(ctx)
NOT_EQUAL_ANY
সিনট্যাক্স:
not_equal_any(value: ANY, search_space: ARRAY) -> BOOLEAN
বিবরণ:
search_space অ্যারেতে value না থাকলে TRUE রিটার্ন করে।
উদাহরণ:
value |
search_space |
not_equal_any(value, search_space) |
|---|---|---|
| ০ লিটার | [1L, 2L, 3L] | TRUE |
| 2L | [1L, 2L, 3L] | FALSE |
NULL |
[1L, 2L, 3L] | TRUE |
NULL |
[১ লিটার, NULL] |
FALSE |
ABSENT |
[১ লিটার, NULL] |
TRUE |
| NaN | [1L, NaN, 3L] | FALSE |
Node.js
const result = await execute(db.pipeline() .collection("books") .select( field("author").notEqualAny(["George Orwell", "F. Scott Fitzgerald"]) .as("byExcludedAuthors") ) );
Web
const result = await execute(db.pipeline() .collection("books") .select( field("author").notEqualAny(["George Orwell", "F. Scott Fitzgerald"]) .as("byExcludedAuthors") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("author").notEqualAny(["George Orwell", "F. Scott Fitzgerald"]) .as("byExcludedAuthors") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("author").notEqualAny(listOf("George Orwell", "F. Scott Fitzgerald")) .alias("byExcludedAuthors") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("author").notEqualAny(Arrays.asList("George Orwell", "F. Scott Fitzgerald")) .alias("byExcludedAuthors") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("author") .not_equal_any(["George Orwell", "F. Scott Fitzgerald"]) .as_("byExcludedAuthors") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select( notEqualAny(field("author"), Arrays.asList("George Orwell", "F. Scott Fitzgerald")) .as("byExcludedAuthors")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.NotEqualAny(firestore.FieldOf("author"), []string{"George Orwell", "F. Scott Fitzgerald"}).As("byExcludedAuthors"), )). Execute(ctx)
সর্বাধিক
সিনট্যাক্স:
maximum(x: ANY...) -> ANY
maximum(x: ARRAY) -> ANY
বিবরণ:
x সিরিজের ভ্যালুর মধ্যে সর্বাধিক NULL নয়, ABSENT নয় এমন ভ্যালু দেখায়।
যদি কোনও নন-NULL, নন-ABSENT ভ্যালু না থাকে, তাহলে NULL রিটার্ন করা হয়।
একাধিক সর্বাধিক সমতুল্য মান থাকলে, সেই মানগুলির মধ্যে যেকোনও একটি ফেরত দেওয়া যেতে পারে। ভ্যালুর ধরন ডকুমেন্ট করা ক্রম অনুযায়ী সাজানো হয়।
উদাহরণ:
x |
y |
maximum(x, y) |
|---|---|---|
FALSE |
TRUE |
TRUE |
FALSE |
-১০L | -১০L |
| 0.0 | -৫L | 0.0 |
| "foo" | "বার" | "foo" |
| "foo" | ["foo"] | ["foo"] |
ABSENT |
ABSENT |
NULL |
NULL |
NULL |
NULL |
Node.js
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").maximum().as("maximumPrice")) );
Web
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").maximum().as("maximumPrice")) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("rating").logicalMaximum([1]).as("flooredRating") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("rating").logicalMaximum(1).alias("flooredRating") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("rating").logicalMaximum(1).alias("flooredRating") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").logical_maximum(1).as_("flooredRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(logicalMaximum(field("rating"), 1).as("flooredRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.LogicalMaximum(firestore.FieldOf("rating"), 1).As("flooredRating"), )). Execute(ctx)
ন্যূনতম
সিনট্যাক্স:
minimum(x: ANY...) -> ANY
minimum(x: ARRAY) -> ANY
বিবরণ:
x মানের সিরিজে সর্বনিম্ন NULL নয়, ABSENT নয় এমন মান দেখায়।
যদি কোনও নন-NULL, নন-ABSENT ভ্যালু না থাকে, তাহলে NULL রিটার্ন করা হয়।
একাধিক ন্যূনতম সমতুল্য মান থাকলে, সেই মানগুলির মধ্যে যেকোনও একটি ফেরত দেওয়া যেতে পারে। ভ্যালুর ধরন ডকুমেন্ট করা ক্রম অনুযায়ী সাজানো হয়।
উদাহরণ:
x |
y |
minimum(x, y) |
|---|---|---|
FALSE |
TRUE |
FALSE |
FALSE |
-১০L | FALSE |
| 0.0 | -৫L | -৫L |
| "foo" | "বার" | "বার" |
| "foo" | ["foo"] | "foo" |
ABSENT |
ABSENT |
NULL |
NULL |
NULL |
NULL |
Node.js
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").minimum().as("minimumPrice")) );
Web
const result = await execute(db.pipeline() .collection("books") .aggregate(field("price").minimum().as("minimumPrice")) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("rating").logicalMinimum([5]).as("cappedRating") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("rating").logicalMinimum(5).alias("cappedRating") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("rating").logicalMinimum(5).alias("cappedRating") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("rating").logical_minimum(5).as_("cappedRating")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(logicalMinimum(field("rating"), 5).as("cappedRating")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.LogicalMinimum(firestore.FieldOf("rating"), 5).As("cappedRating"), )). Execute(ctx)
ম্যাপ ফাংশন
| নাম | বিবরণ |
MAP
|
কী-ভ্যালু পেয়ারের সিরিজ থেকে ম্যাপ ভ্যালু তৈরি করে |
MAP_GET
|
নির্দিষ্ট কী দেওয়া থাকলে ম্যাপে ভ্যালু দেখায় |
MAP_SET
|
আপডেট করা কী-এর সিরিজ সহ ম্যাপের কপি দেখায় |
MAP_REMOVE
|
কী-এর সিরিজ সরিয়ে দিয়ে ম্যাপের কপি দেখায় |
MAP_MERGE
|
একসাথে একাধিক ম্যাপ মার্জ করে। |
CURRENT_CONTEXT
|
বর্তমান কনটেক্সট ম্যাপ হিসেবে দেখায়। |
MAP_KEYS
|
ম্যাপে সব 'কী'-এর অ্যারে দেখায়। |
MAP_VALUES
|
ম্যাপে সব ভ্যালুর অ্যারে দেখায়। |
MAP_ENTRIES
|
ম্যাপের কী-ভ্যালু পেয়ারের অ্যারে দেখায়। |
ম্যাপ
সিনট্যাক্স:
map(key: STRING, value: ANY, ...) -> MAP
বিবরণ:
কী-ভ্যালু পেয়ারের সিরিজ থেকে একটি ম্যাপ তৈরি করে।
MAP_GET
সিনট্যাক্স:
map_get(map: ANY, key: STRING) -> ANY
বিবরণ:
নির্দিষ্ট কী দেওয়া থাকলে ম্যাপে মান দেখায়। ম্যাপে key না থাকলে অথবা map আর্গুমেন্ট MAP না হলে, ABSENT ভ্যালু দেখায়।
Node.js
const result = await db.pipeline() .collection("books") .select( field("awards").mapGet("pulitzer").as("hasPulitzerAward") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("awards").mapGet("pulitzer").as("hasPulitzerAward") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("awards").mapGet("pulitzer").as("hasPulitzerAward") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("awards").mapGet("pulitzer").alias("hasPulitzerAward") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("awards").mapGet("pulitzer").alias("hasPulitzerAward") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("awards").map_get("pulitzer").as_("hasPulitzerAward")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(mapGet(field("awards"), "pulitzer").as("hasPulitzerAward")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.MapGet(firestore.FieldOf("awards"), "pulitzer").As("hasPulitzerAward"), )). Execute(ctx)
MAP_SET
সিনট্যাক্স:
map_set(map: MAP, key: STRING, value: ANY, ...) -> MAP
বিবরণ:
map ভ্যালুর একটি কপি রিটার্ন করে যার কন্টেন্ট কী-ভ্যালু পেয়ারের একটি সিরিজ দ্বারা আপডেট করা হয়েছে।
প্রদত্ত মান যদি অনুপস্থিত মান হিসেবে সমাধান করা হয়, তাহলে সংশ্লিষ্ট কী ম্যাপ থেকে সরানো হয়।
map আর্গুমেন্ট MAP না হলে, অনুপস্থিত ভ্যালু দেখায়।
MAP_REMOVE
সিনট্যাক্স:
map_remove(map: MAP, key: STRING...) -> MAP
বিবরণ:
একাধিক কী সরিয়ে দেওয়ার পরে map ভ্যালুর কপি দেখায়।
MAP_MERGE
সিনট্যাক্স:
map_merge(maps: MAP...) -> MAP
২ বা তার বেশি ম্যাপের কন্টেন্ট মার্জ করে। একাধিক ম্যাপে পরস্পরবিরোধী ভ্যালু থাকলে, শেষ ভ্যালুটি ব্যবহার করা হয়।
CURRENT_CONTEXT
সিনট্যাক্স:
current_context() -> MAP
এক্সিকিউশনের বর্তমান পয়েন্টে উপলভ্য সব ফিল্ড সহ একটি ম্যাপ রিটার্ন করে।
MAP_KEYS
সিনট্যাক্স:
map_keys(map: MAP) -> ARRAY<STRING>
বিবরণ:
map ভ্যালুর সব কী সহ একটি অ্যারে রিটার্ন করে।
MAP_VALUES
সিনট্যাক্স:
map_values(map: MAP) -> ARRAY<ANY>
বিবরণ:
map ভ্যালুর সব ভ্যালু সহ একটি অ্যারে রিটার্ন করে।
MAP_ENTRIES
সিনট্যাক্স:
map_entries(map: MAP) -> ARRAY<MAP>
বিবরণ:
map ভ্যালুতে সব কী-ভ্যালু পেয়ার সহ একটি অ্যারে রিটার্ন করে।
প্রতিটি কী-ভ্যালু পেয়ার k এবং v, এই দুটি এন্ট্রি সহ একটি ম্যাপের আকারে থাকবে।
উদাহরণ:
map |
map_entries(map) |
|---|---|
| {} | [কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
| {"foo" : 2L} | [{"k": "foo", "v" : 2L}] |
| {"foo" : "bar", "bar" : "foo"} | [{"k": "foo", "v" : "bar" }, {"k" : "bar", "v": "foo"}] |
স্ট্রিং ফাংশন
| নাম | বিবরণ |
BYTE_LENGTH
|
STRING বা BYTES ভ্যালুতে BYTES-এর সংখ্যা দেখায়
|
CHAR_LENGTH
|
STRING মানে ইউনিকোড অক্ষরের সংখ্যা দেখায়
|
STARTS_WITH
|
STRING প্রদত্ত প্রিফিক্স দিয়ে শুরু হলে TRUE রিটার্ন করে
|
ENDS_WITH
|
প্রদত্ত পোস্টফিক্স দিয়ে STRING শেষ হলে TRUE রিটার্ন করে
|
LIKE
|
STRING কোনও প্যাটার্নের সাথে ম্যাচ করলে TRUE রিটার্ন করে
|
REGEX_CONTAINS
|
কোনও ভ্যালু রেগুলার এক্সপ্রেশনের সাথে আংশিক বা সম্পূর্ণভাবে মিলে গেলে TRUE রিটার্ন করে
|
REGEX_FIND
|
রেগুলার এক্সপ্রেশনের সাথে ম্যাচ করে এমন প্রথম সাবস্ট্রিং বা কোনও ম্যাচ না থাকলে NULL রিটার্ন করে।
|
REGEX_FIND_ALL
|
রেগুলার এক্সপ্রেশনের সাথে মেলে এমন সব সাবস্ট্রিংয়ের অ্যারে অথবা কোনও মিল না থাকলে খালি অ্যারে দেখায়। |
REGEX_MATCH
|
কোনও ভ্যালুর যেকোনও অংশ রেগুলার এক্সপ্রেশনের সাথে মিললে TRUE রিটার্ন করে
|
STRING_CONCAT
|
একাধিক STRING-কে একটি STRING-এ কনক্যাটিনেট করে
|
STRING_CONTAINS
|
কোনও ভ্যালুতে STRING থাকলে TRUE রিটার্ন করে
|
STRING_INDEX_OF
|
STRING বা BYTES ভ্যালুর প্রথম ঘটনার ০-ভিত্তিক ইন্ডেক্স রিটার্ন করে।
|
TO_UPPER
|
STRING বা BYTES ভ্যালু বড় হাতের অক্ষরে কনভার্ট করে।
|
TO_LOWER
|
STRING বা BYTES ভ্যালুকে ছোট হাতের অক্ষরে কনভার্ট করে।
|
SUBSTRING
|
STRING বা BYTES ভ্যালুর সাবস্ট্রিং পায়।
|
STRING_REVERSE
|
STRING বা BYTES ভ্যালু রিভার্স করে।
|
STRING_REPEAT
|
নির্দিষ্ট সংখ্যক বার STRING বা BYTES মান রিপিট করে।
|
STRING_REPLACE_ALL
|
STRING বা BYTES ভ্যালুর সব ঘটনা পরিবর্তন করে।
|
STRING_REPLACE_ONE
|
STRING বা BYTES ভ্যালুর প্রথম ঘটনাকে প্রতিস্থাপন করে।
|
TRIM
|
STRING বা BYTES ভ্যালু থেকে প্রথম ও শেষের অক্ষর ট্রিম করে।
|
LTRIM
|
STRING বা BYTES ভ্যালু থেকে প্রথমের অক্ষর ট্রিম করে।
|
RTRIM
|
STRING বা BYTES ভ্যালু থেকে ট্রেলিং অক্ষর ট্রিম করে।
|
SPLIT
|
STRING বা BYTES ভ্যালুকে একটি অ্যারেতে স্প্লিট করে।
|
BYTE_LENGTH
সিনট্যাক্স:
byte_length[T <: STRING | BYTES](value: T) -> INT64
বিবরণ:
STRING বা BYTES মানে BYTES-এর সংখ্যা দেখায়।
উদাহরণ:
| মান | byte_length(value) |
|---|---|
| "abc" | 3 |
| "xyzabc" | 6 |
| b"abc" | 3 |
Node.js
const result = await db.pipeline() .collection("books") .select( field("title").byteLength().as("titleByteLength") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("title").byteLength().as("titleByteLength") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("title").byteLength().as("titleByteLength") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("title").byteLength().alias("titleByteLength") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("title").byteLength().alias("titleByteLength") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("title").byte_length().as_("titleByteLength")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(byteLength(field("title")).as("titleByteLength")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.ByteLength(firestore.FieldOf("title")).As("titleByteLength"), )). Execute(ctx)
CHAR_LENGTH
সিনট্যাক্স:
char_length(value: STRING) -> INT64
বিবরণ:
STRING ভ্যালুতে ইউনিকোড কোড পয়েন্টের সংখ্যা দেখায়।
উদাহরণ:
| মান | char_length(value) |
|---|---|
| "abc" | 3 |
| "হ্যালো" | 5 |
| "বিশ্ব" | 5 |
Node.js
const result = await db.pipeline() .collection("books") .select( field("title").charLength().as("titleCharLength") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("title").charLength().as("titleCharLength") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("title").charLength().as("titleCharLength") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("title").charLength().alias("titleCharLength") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("title").charLength().alias("titleCharLength") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("title").char_length().as_("titleCharLength")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(charLength(field("title")).as("titleCharLength")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.CharLength(firestore.FieldOf("title")).As("titleCharLength"), )). Execute(ctx)
STARTS_WITH
সিনট্যাক্স:
starts_with(value: STRING, prefix: STRING) -> BOOLEAN
বিবরণ:
value, prefix দিয়ে শুরু হলে TRUE ফেরত পাঠায়।
উদাহরণ:
| মান | উপসর্গ | starts_with(value, prefix) |
|---|---|---|
| "abc" | "a" | সত্য |
| "abc" | "b" | মিথ্যা |
| "abc" | "" | সত্য |
Node.js
const result = await db.pipeline() .collection("books") .select( field("title").startsWith("The") .as("needsSpecialAlphabeticalSort") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("title").startsWith("The") .as("needsSpecialAlphabeticalSort") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("title").startsWith("The") .as("needsSpecialAlphabeticalSort") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("title").startsWith("The") .alias("needsSpecialAlphabeticalSort") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("title").startsWith("The") .alias("needsSpecialAlphabeticalSort") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("title").starts_with("The").as_("needsSpecialAlphabeticalSort") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(startsWith(field("title"), "The").as("needsSpecialAlphabeticalSort")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.StartsWith(firestore.FieldOf("title"), "The").As("needsSpecialAlphabeticalSort"), )). Execute(ctx)
ENDS_WITH
সিনট্যাক্স:
ends_with(value: STRING, postfix: STRING) -> BOOLEAN
বিবরণ:
value, postfix দিয়ে শেষ হলে TRUE রিটার্ন করে।
উদাহরণ:
| মান | পোস্টফিক্স | ends_with(value, postfix) |
|---|---|---|
| "abc" | "c" | সত্য |
| "abc" | "b" | মিথ্যা |
| "abc" | "" | সত্য |
Node.js
const result = await db.pipeline() .collection("inventory/devices/laptops") .select( field("name").endsWith("16 inch") .as("16InLaptops") ) .execute();
Swift
let result = try await db.pipeline() .collection("inventory/devices/laptops") .select([ Field("name").endsWith("16 inch") .as("16InLaptops") ]) .execute()
Kotlin
val result = db.pipeline() .collection("inventory/devices/laptops") .select( field("name").endsWith("16 inch") .alias("16InLaptops") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("inventory/devices/laptops") .select( field("name").endsWith("16 inch") .alias("16InLaptops") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("inventory/devices/laptops") .select(Field.of("name").ends_with("16 inch").as_("16InLaptops")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("inventory/devices/laptops") .select(endsWith(field("name"), "16 inch").as("16InLaptops")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("inventory/devices/laptops"). Select(firestore.Fields( firestore.EndsWith(firestore.FieldOf("name"), "16 inch").As("`Laptops16in`"), )). Execute(ctx)
পছন্দ করুন
সিনট্যাক্স:
like(value: STRING, pattern: STRING) -> BOOLEAN
বিবরণ:
value-এর সাথে pattern-এর মিল থাকলে TRUE রিটার্ন করে।
উদাহরণ:
| মান | প্যাটার্ন | like(value, pattern) |
|---|---|---|
| "Firestore" | "আগুন%" | সত্য |
| "Firestore" | "%store" | সত্য |
| "Datastore" | "Data_tore" | সত্য |
| "১০০%" | "১০০\%" | সত্য |
Node.js
const result = await db.pipeline() .collection("books") .select( field("genre").like("%Fiction") .as("anyFiction") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("genre").like("%Fiction") .as("anyFiction") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("genre").like("%Fiction") .as("anyFiction") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("genre").like("%Fiction") .alias("anyFiction") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("genre").like("%Fiction") .alias("anyFiction") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("genre").like("%Fiction").as_("anyFiction")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(like(field("genre"), "%Fiction").as("anyFiction")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Like(firestore.FieldOf("genre"), "%Fiction").As("anyFiction"), )). Execute(ctx)
REGEX_CONTAINS
সিনট্যাক্স:
regex_contains(value: STRING, regexp: STRING | REGEX) -> BOOLEAN
বিবরণ:
value-এর কোনও অংশ regexp-এর সাথে ম্যাচ করলে TRUE রিটার্ন করে। regexp সঠিক রেগুলার এক্সপ্রেশন না হলে, এই ফাংশন error রিটার্ন করে।
regexp আর্গুমেন্টটি REGEX ভ্যালুও হতে পারে যা
regex("pattern", "options") ব্যবহার করে তৈরি করা হয়েছে। এই ফর্ম্যাট আপনাকে প্যাটার্নের সাথে রেগুলার এক্সপ্রেশন
বিকল্প প্রদান করতে দেয়। যেসব বিকল্প কাজ করে সেগুলি হল:
i: ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয় না।m: মাল্টি-লাইন মোড (^এবং$লাইনের শুরু বা শেষের সাথে মেলে)।s: Dotall মোড (.নতুন লাইনের সাথে মেলে)।
regexp যদি STRING হয়, তাহলে প্যাটার্নে এম্বেড করা বিকল্প ছাড়া অন্য কোনও বিকল্প প্রয়োগ করা হয় না (যেমন, (?i))।
রেগুলার এক্সপ্রেশন re2 লাইব্রেরির সিনট্যাক্স মেনে চলে।
উদাহরণ:
| মান | রেগুলার এক্সপ্রেশন | regex_contains(value, regexp) |
|---|---|---|
| "Firestore" | "আগুন" | সত্য |
| "Firestore" | "store$" | সত্য |
| "Firestore" | "ডেটা" | মিথ্যা |
| "Firestore" | regex("fire", "i") |
সত্য |
| "Firestore" | regex("FIRE", "") |
মিথ্যা |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("title").regexContains("Firestore (Enterprise|Standard)") .as("isFirestoreRelated") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("title").regexContains("Firestore (Enterprise|Standard)") .as("isFirestoreRelated") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("title").regexContains("Firestore (Enterprise|Standard)") .as("isFirestoreRelated") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("title").regexContains("Firestore (Enterprise|Standard)") .alias("isFirestoreRelated") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("title").regexContains("Firestore (Enterprise|Standard)") .alias("isFirestoreRelated") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("title") .regex_contains("Firestore (Enterprise|Standard)") .as_("isFirestoreRelated") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select( regexContains(field("title"), "Firestore (Enterprise|Standard)") .as("isFirestoreRelated")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.RegexContains(firestore.FieldOf("title"), "Firestore (Enterprise|Standard)").As("isFirestoreRelated"), )). Execute(ctx)
REGEX_FIND
সিনট্যাক্স:
regex_find(value: STRING, regexp: STRING | REGEX) -> STRING
বিবরণ:
value-এ প্রথম সাবস্ট্রিং রিটার্ন করে যা regexp-এর সাথে মেলে, অথবা কোনও মিল না থাকলে
NULL রিটার্ন করে। regexp সঠিক রেগুলার এক্সপ্রেশন না হলে, এই ফাংশন
error রিটার্ন করে।
regexp আর্গুমেন্টটি REGEX ভ্যালুও হতে পারে যা
regex("pattern", "options") ব্যবহার করে তৈরি করা হয়েছে। এই ফর্ম্যাট আপনাকে প্যাটার্নের সাথে রেগুলার এক্সপ্রেশন
বিকল্প প্রদান করতে দেয়। যেসব বিকল্প কাজ করে সেগুলি হল:
i: ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয় না।m: মাল্টি-লাইন মোড (^এবং$লাইনের শুরু বা শেষের সাথে মেলে)।s: Dotall মোড (.নতুন লাইনের সাথে মেলে)।
regexp যদি STRING হয়, তাহলে প্যাটার্নে এম্বেড করা বিকল্প ছাড়া অন্য কোনও বিকল্প প্রয়োগ করা হয় না (যেমন, (?i))।
রেগুলার এক্সপ্রেশন re2 লাইব্রেরির সিনট্যাক্স মেনে চলে।
উদাহরণ:
| মান | রেগুলার এক্সপ্রেশন | regex_find(value, regexp) |
|---|---|---|
| "Sometext MATCH" | "SomeText" | "Sometext" |
| "Sometext MATCH" | regex("match", "i") |
"ম্যাচ" |
| "Sometext MATCH" | regex("(match)", "i") |
"ম্যাচ" |
| "Sometext match" | regex("MATCH", "") |
ফাঁকা |
REGEX_FIND_ALL
সিনট্যাক্স:
regex_find_all(value: STRING, regexp: STRING | REGEX) -> ARRAY<STRING>
বিবরণ:
value-এ থাকা সব সাবস্ট্রিংয়ের একটি অ্যারে দেখায় যা regexp-এর সাথে মেলে অথবা কোনও মিল না থাকলে একটি খালি
অ্যারে দেখায়। regexp সঠিক রেগুলার এক্সপ্রেশন না হলে,
এই ফাংশন error রিটার্ন করে।
regexp আর্গুমেন্টটি REGEX ভ্যালুও হতে পারে যা
regex("pattern", "options") ব্যবহার করে তৈরি করা হয়েছে। এই ফর্ম্যাট আপনাকে প্যাটার্নের সাথে রেগুলার এক্সপ্রেশন
বিকল্প প্রদান করতে দেয়। যেসব বিকল্প কাজ করে সেগুলি হল:
i: ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয় না।m: মাল্টি-লাইন মোড (^এবং$লাইনের শুরু বা শেষের সাথে মেলে)।s: Dotall মোড (.নতুন লাইনের সাথে মেলে)।
regexp যদি STRING হয়, তাহলে প্যাটার্নে এম্বেড করা বিকল্প ছাড়া অন্য কোনও বিকল্প প্রয়োগ করা হয় না (যেমন, (?i))।
রেগুলার এক্সপ্রেশন re2 লাইব্রেরির সিনট্যাক্স মেনে চলে।
উদাহরণ:
| মান | রেগুলার এক্সপ্রেশন | regex_find_all(value, regexp) |
|---|---|---|
| "এক দুই তিন দুই" | "এক" | ["one"] |
| "এক দুই তিন দুই" | regex("two", "i") |
["TWO", "Two"] |
| "এক দুই তিন দুই" | regex("TWO", "") |
[কোথায় ছিলেন?][তারপর, কোথায় ছিলেন?][এতদিন কোথায় ছিলেন?][কোথায় ছিলেন বলুন তো?][কোথায় ছিলে][কোথায় ছিলি][কোথায় ছিলি এতদিন][কোথায় ছিলে এতদিন] |
REGEX_MATCH
সিনট্যাক্স:
regex_match(value: STRING, regexp: STRING | REGEX) -> BOOLEAN
বিবরণ:
value-এর সাথে regexp সম্পূর্ণভাবে মিলে গেলে TRUE রিটার্ন করে। regexp সঠিক রেগুলার এক্সপ্রেশন
না হলে, এই ফাংশন error রিটার্ন করে।
regexp আর্গুমেন্টটি REGEX ভ্যালুও হতে পারে যা
regex("pattern", "options") ব্যবহার করে তৈরি করা হয়েছে। এই ফর্ম্যাট আপনাকে প্যাটার্নের সাথে রেগুলার এক্সপ্রেশন
বিকল্প প্রদান করতে দেয়। যেসব বিকল্প কাজ করে সেগুলি হল:
i: ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয় না।m: মাল্টি-লাইন মোড (^এবং$লাইনের শুরু বা শেষের সাথে মেলে)।s: Dotall মোড (.নতুন লাইনের সাথে মেলে)।
regexp যদি STRING হয়, তাহলে প্যাটার্নে এম্বেড করা বিকল্প ছাড়া অন্য কোনও বিকল্প প্রয়োগ করা হয় না (যেমন, (?i))।
রেগুলার এক্সপ্রেশন re2 লাইব্রেরির সিনট্যাক্স মেনে চলে।
উদাহরণ:
| মান | রেগুলার এক্সপ্রেশন | regex_match(value, regexp) |
|---|---|---|
| "Firestore" | "F.*store" | সত্য |
| "Firestore" | "আগুন" | মিথ্যা |
| "Firestore" | "^F.*e$" | সত্য |
| "FiReStOrE" | regex("firestore", "i") |
সত্য |
| "Firestore" | regex("firestore", "") |
মিথ্যা |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("title").regexMatch("Firestore (Enterprise|Standard)") .as("isFirestoreExactly") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("title").regexMatch("Firestore (Enterprise|Standard)") .as("isFirestoreExactly") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("title").regexMatch("Firestore (Enterprise|Standard)") .as("isFirestoreExactly") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("title").regexMatch("Firestore (Enterprise|Standard)") .alias("isFirestoreExactly") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("title").regexMatch("Firestore (Enterprise|Standard)") .alias("isFirestoreExactly") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("title") .regex_match("Firestore (Enterprise|Standard)") .as_("isFirestoreExactly") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select( regexMatch(field("title"), "Firestore (Enterprise|Standard)") .as("isFirestoreExactly")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.RegexMatch(firestore.FieldOf("title"), "Firestore (Enterprise|Standard)").As("isFirestoreExactly"), )). Execute(ctx)
STRING_CONCAT
সিনট্যাক্স:
string_concat(values: STRING...) -> STRING
বিবরণ:
দুই বা তার বেশি STRING ভ্যালু কনক্যাটিনেট করে একটি ফলাফল দেখায়।
উদাহরণ:
| আর্গুমেন্ট | string_concat(values...) |
|---|---|
() |
ত্রুটি |
("a") |
"a" |
("abc", "def") |
"abcdef" |
("a", "", "c") |
"এসি" |
Node.js
const result = await db.pipeline() .collection("books") .select( field("title").stringConcat(" by ", field("author")) .as("fullyQualifiedTitle") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("title").stringConcat(" by ", field("author")) .as("fullyQualifiedTitle") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("title").concat([" by ", Field("author")]) .as("fullyQualifiedTitle") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("title").concat(" by ", field("author")) .alias("fullyQualifiedTitle") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("title").concat(" by ", field("author")) .alias("fullyQualifiedTitle") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select( Field.of("title") .concat(" by ", Field.of("author")) .as_("fullyQualifiedTitle") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(stringConcat(field("title"), " by ", field("author")).as("fullyQualifiedTitle")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.StringConcat(firestore.FieldOf("title"), " by ", firestore.FieldOf("author")).As("fullyQualifiedTitle"), )). Execute(ctx)
STRING_CONTAINS
সিনট্যাক্স:
string_contains(value: STRING, substring: STRING) -> BOOLEAN
বিবরণ:
value-এ লিটারেল স্ট্রিং substring আছে কিনা তা চেক করে।
উদাহরণ:
| মান | সাবস্ট্রিং | string_contains(value, substring) |
|---|---|---|
| "abc" | "b" | সত্য |
| "abc" | "d" | মিথ্যা |
| "abc" | "" | সত্য |
| "এ.সি" | "." | সত্য |
| "☃☃☃" | "☃" | সত্য |
Node.js
const result = await db.pipeline() .collection("articles") .select( field("body").stringContains("Firestore") .as("isFirestoreRelated") ) .execute();
Web
const result = await execute(db.pipeline() .collection("articles") .select( field("body").stringContains("Firestore") .as("isFirestoreRelated") ) );
Swift
let result = try await db.pipeline() .collection("articles") .select([ Field("body").stringContains("Firestore") .as("isFirestoreRelated") ]) .execute()
Kotlin
val result = db.pipeline() .collection("articles") .select( field("body").stringContains("Firestore") .alias("isFirestoreRelated") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("articles") .select( field("body").stringContains("Firestore") .alias("isFirestoreRelated") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("articles") .select(Field.of("body").string_contains("Firestore").as_("isFirestoreRelated")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("articles") .select(stringContains(field("body"), "Firestore").as("isFirestoreRelated")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("articles"). Select(firestore.Fields( firestore.StringContains(firestore.FieldOf("body"), "Firestore").As("isFirestoreRelated"), )). Execute(ctx)
STRING_INDEX_OF
সিনট্যাক্স:
string_index_of[T <: STRING | BYTES](value: T, search: T) -> INT64
বিবরণ:
value-এ search-এর প্রথম ঘটনার ০-ভিত্তিক ইন্ডেক্স ফিরিয়ে দেয়।
searchখুঁজে না পাওয়া গেলে-1দেখায়।valueযদিSTRINGভ্যালু হয়, তাহলে ফলাফল ইউনিকোড কোড পয়েন্টে পরিমাপ করা হয়। এটিBYTESভ্যালু হলে, বাইটে পরিমাপ করা হয়।searchযদি খালিSTRINGবাBYTESভ্যালু হয়, তাহলে ফলাফল হবে0।
উদাহরণ:
| মান | সার্চ করুন | string_index_of(value, search) |
|---|---|---|
| "হ্যালো ওয়ার্ল্ড" | "o" | 4 |
| "হ্যালো ওয়ার্ল্ড" | "l" | 2 |
| "হ্যালো ওয়ার্ল্ড" | "z" | -১ |
| "কলা" | "ana" | 1 |
| "abc" | "" | 0 |
| b"abc" | b"b" | 1 |
| "é" | "é" | 0 |
| b"é" | b"é" | 0 |
TO_UPPER
সিনট্যাক্স:
to_upper[T <: STRING | BYTES](value: T) -> T
বিবরণ:
STRING বা BYTES ভ্যালু বড় হাতের অক্ষরে কনভার্ট করে।
কোনও বাইট বা ক্যারেক্টার UTF-8 ছোট হাতের বর্ণমালার অক্ষরের সাথে না মিললে, এটি অপরিবর্তিত অবস্থায় পাস করা হয়।
উদাহরণ:
| মান | to_upper(value) |
|---|---|
| "abc" | "ABC" |
| "AbC" | "ABC" |
| b"abc" | b"ABC" |
| b"a1c" | b"A1C" |
Node.js
const result = await db.pipeline() .collection("authors") .select( field("name").toUpper() .as("uppercaseName") ) .execute();
Web
const result = await execute(db.pipeline() .collection("authors") .select( field("name").toUpper() .as("uppercaseName") ) );
Swift
let result = try await db.pipeline() .collection("authors") .select([ Field("name").toUpper() .as("uppercaseName") ]) .execute()
Kotlin
val result = db.pipeline() .collection("authors") .select( field("name").toUpper() .alias("uppercaseName") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("authors") .select( field("name").toUpper() .alias("uppercaseName") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("authors") .select(Field.of("name").to_upper().as_("uppercaseName")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("authors") .select(toUpper(field("name")).as("uppercaseName")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("authors"). Select(firestore.Fields( firestore.ToUpper(firestore.FieldOf("name")).As("uppercaseName"), )). Execute(ctx)
TO_LOWER
সিনট্যাক্স:
to_lower[T <: STRING | BYTES](value: T) -> T
বিবরণ:
STRING বা BYTES ভ্যালুকে ছোট হাতের অক্ষরে কনভার্ট করে।
কোনও বাইট বা অক্ষর UTF-8 বড় হাতের বর্ণমালার অক্ষরের সাথে না মিললে, এটি অপরিবর্তিত অবস্থায় পাস করা হয়।
উদাহরণ:
| মান | to_lower(value) |
|---|---|
| "ABC" | "abc" |
| "AbC" | "abc" |
| "A1C" | "a1c" |
| b"ABC" | b"abc" |
Node.js
const result = await db.pipeline() .collection("authors") .select( field("genre").toLower().equal("fantasy") .as("isFantasy") ) .execute();
Web
const result = await execute(db.pipeline() .collection("authors") .select( field("genre").toLower().equal("fantasy") .as("isFantasy") ) );
Swift
let result = try await db.pipeline() .collection("authors") .select([ Field("genre").toLower().equal("fantasy") .as("isFantasy") ]) .execute()
Kotlin
val result = db.pipeline() .collection("authors") .select( field("genre").toLower().equal("fantasy") .alias("isFantasy") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("authors") .select( field("genre").toLower().equal("fantasy") .alias("isFantasy") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("authors") .select(Field.of("genre").to_lower().equal("fantasy").as_("isFantasy")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("authors") .select(equal(toLower(field("genre")), "fantasy").as("isFantasy")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("authors"). Select(firestore.Fields( firestore.Equal(firestore.ToLower(firestore.FieldOf("genre")), "fantasy").As("isFantasy"), )). Execute(ctx)
SUBSTRING
সিনট্যাক্স:
substring[T <: STRING | BYTES](input: T, position: INT64) -> T
substring[T <: STRING | BYTES](input: T, position: INT64, length: INT64) -> T
বিবরণ:
position (শূন্য-ভিত্তিক ইন্ডেক্স) থেকে শুরু করে এবং length পর্যন্ত এন্ট্রি সহ input-এর একটি সাবস্ট্রিং দেখায়। কোনও length প্রদান করা না হলে, position থেকে input-এর শেষ পর্যন্ত
সাবস্ট্রিং
ফেরত দেয়।
inputযদিSTRINGভ্যালু হয়, তাহলেpositionএবংlengthইউনিকোড কোড পয়েন্টে পরিমাপ করা হয়। এটিBYTESভ্যালু হলে, বাইটে পরিমাপ করা হয়।position-এর মানinput-এর দৈর্ঘ্যের থেকে বেশি হলে, একটি খালি সাবস্ট্রিং ফেরত দেওয়া হয়।positionপ্লাসlengthযদিinput-এর দৈর্ঘ্যের চেয়ে বেশি হয়, তাহলে সাবস্ট্রিংটিinput-এর শেষ পর্যন্ত ট্রাঙ্কেট করা হয়।positionনেগেটিভ হলে, ইনপুটের শেষ থেকে পজিশন নেওয়া হয়। নেগেটিভposition-এর মান ইনপুটের সাইজের চেয়ে বেশি হলে, পজিশন শূন্যতে সেট করা হয়।lengthঅবশ্যই নেগেটিভ নয় এমন সংখ্যা হতে হবে।
উদাহরণ:
length উল্লেখ না করা থাকলে:
| ইনপুট | পজিশন | substring(input, position) |
|---|---|---|
| "abc" | 0 | "abc" |
| "abc" | 1 | "bc" |
| "abc" | 3 | "" |
| "abc" | -১ | "c" |
| b"abc" | 1 | b"bc" |
length প্রদান করা হলে:
| ইনপুট | পজিশন | দৈর্ঘ্য | substring(input, position, length) |
|---|---|---|---|
| "abc" | 0 | 1 | "a" |
| "abc" | 1 | 2 | "bc" |
| "abc" | -১ | 1 | "c" |
| b"abc" | 0 | 1 | b"a" |
Node.js
const result = await db.pipeline() .collection("books") .where(field("title").startsWith("The ")) .select( field("title").substring(4) .as("titleWithoutLeadingThe") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .where(field("title").startsWith("The ")) .select( field("title").substring(4) .as("titleWithoutLeadingThe") ) );
Swift
let result = try await db.pipeline() .collection("books") .where(Field("title").startsWith("The ")) .select([ Field("title").substring(position: 4) .as("titleWithoutLeadingThe") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .where(field("title").startsWith("The ")) .select( field("title") .substring(constant(4), field("title").charLength().subtract(4)) .alias("titleWithoutLeadingThe") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .where(field("title").startsWith("The ")) .select( field("title").substring( constant(4), field("title").charLength().subtract(4)) .alias("titleWithoutLeadingThe") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .where(Field.of("title").starts_with("The ")) .select(Field.of("title").substring(4).as_("titleWithoutLeadingThe")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .where(startsWith(field("title"), "The ")) .select( substring(field("title"), constant(4), field("title").charLength()) .as("titleWithoutLeadingThe")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Where(firestore.StartsWith(firestore.FieldOf("title"), "The ")). Select(firestore.Fields( firestore.Substring(firestore.FieldOf("title"), firestore.ConstantOf(4), firestore.FieldOf("title").CharLength()).As("titleWithoutLeadingThe"), )). Execute(ctx)
STRING_REVERSE
সিনট্যাক্স:
string_reverse[T <: STRING | BYTES](input: T) -> T
বিবরণ:
প্রদান করা ইনপুট বিপরীত ক্রমে দেখায়।
ইনপুট STRING হলে ইউনিকোড কোড পয়েন্টের মাধ্যমে অক্ষরগুলি চিহ্নিত করা হয়,
এবং ইনপুট BYTES ভ্যালু হলে বাইটের মাধ্যমে চিহ্নিত করা হয়।
উদাহরণ:
| ইনপুট | string_reverse(input) |
|---|---|
| "abc" | "cba" |
| "a🌹b" | "b🌹a" |
| "হ্যালো" | "olleh" |
| b"abc" | b"cba" |
Node.js
const result = await db.pipeline() .collection("books") .select( field("name").reverse().as("reversedName") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("name").reverse().as("reversedName") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("name").reverse().as("reversedName") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("name").reverse().alias("reversedName") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("name").reverse().alias("reversedName") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("name").string_reverse().as_("reversedName")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(reverse(field("name")).as("reversedName")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Reverse(firestore.FieldOf("name")).As("reversedName"), )). Execute(ctx)
STRING_REPEAT
সিনট্যাক্স:
string_repeat[T <: STRING | BYTES](input: T, repetitions: INT64) -> T
বিবরণ:
input-কে repetitions বার রিপিট করে দেখায়।
repetitionsঅবশ্যই নেগেটিভ নয় এমন পূর্ণসংখ্যা হতে হবে।repetitionsযদি0হয়, তাহলেinput-এর মতো একই ধরনের খালি ভ্যালু দেখায়।- ফলাফল অনুমোদিত সর্বাধিক সাইজ (১ এমবি) পেরিয়ে গেলে, একটি সমস্যা দেখানো হয়।
উদাহরণ:
| ইনপুট | বার | string_repeat(input, repetitions) |
|---|---|---|
| "foo" | 3 | "foofoofoo" |
| "foo" | 0 | "" |
| "একটি " | 3 | "a a a " |
| b"ab" | 2 | b"abab" |
| "é🦆" | 2 | "é🦆é🦆" |
STRING_REPLACE_ALL
সিনট্যাক্স:
string_replace_all[T <: STRING | BYTES](input: T, find: T, replacement: T) -> T
বিবরণ:
input-এ find-এর সব নন-ওভারল্যাপিং ঘটনা replacement দিয়ে
পরিবর্তন করে।
- ম্যাচ করার সময় ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয়।
findফাঁকা থাকলে, কোনও কিছু পরিবর্তন করা হয় না।
উদাহরণ:
| ইনপুট | খুঁজুন | পরিবর্তে | string_replace_all(input, find, replacement) |
|---|---|---|---|
| "foobarfoo" | "foo" | "baz" | "bazbarbaz" |
| "ababab" | "aba" | "c" | "cbab" |
| "foobar" | "o" | "" | "fbar" |
| "é🦆🌎🦆" | "🦆" | "a" | "éa🌎a" |
| b"abc" | b"b" | b"d" | b"adc" |
STRING_REPLACE_ONE
সিনট্যাক্স:
string_replace_one[T <: STRING | BYTES](input: T, find: T, replacement: T) -> T
বিবরণ:
input-এ find-এর প্রথম ঘটনাকে replacement দিয়ে প্রতিস্থাপন করে।
- ম্যাচ করার সময় ছোট ও বড় হাতের অক্ষরের মধ্যে পার্থক্য করা হয়।
findফাঁকা থাকলে, কোনও কিছু পরিবর্তন করা হয় না।
উদাহরণ:
| ইনপুট | খুঁজুন | পরিবর্তে | string_replace_one(input, find, replacement) |
|---|---|---|---|
| "foobarfoo" | "foo" | "baz" | "bazbarfoo" |
| "é" | "é" | "a" | "a" |
| b"foobar" | b"o" | b"z" | b"fzoobar" |
ট্রিম করুন
সিনট্যাক্স:
trim[T <: STRING | BYTES](input: T, values_to_trim: T) -> T
trim[T <: STRING | BYTES](input: T) -> T
বিবরণ:
প্রদান করা input-এর শুরু ও শেষ থেকে BYTES বা CHARS-এর নির্দিষ্ট সেট ট্রিম করে।
- কোনও
values_to_trimপ্রদান করা না হলে, হোয়াইটস্পেস অক্ষর ট্রিম করে।
উদাহরণ:
values_to_trim উল্লেখ না করা থাকলে:
| ইনপুট | trim(input) |
|---|---|
| " foo " | "foo" |
| b" foo " | b"foo" |
| "foo" | "foo" |
| "" | "" |
| " " | "" |
| "\t foo \n" | "foo" |
| b"\t foo \n" | b"foo" |
| "\r\f\v foo \r\f\v" | "foo" |
| b"\r\f\v foo \r\f\v" | b"foo" |
values_to_trim প্রদান করা হলে:
| ইনপুট | values_to_trim | trim(input, values_to_trim) |
|---|---|---|
| "abcbfooaacb" | "abc" | "foo" |
| "abcdaabadbac" | "abc" | "দাবাদ" |
| b"C1C2C3" | b"C1" | b"C2C3" |
| b"C1C2" | "foo" | ত্রুটি |
| "foo" | b"C1" | ত্রুটি |
Web
const result = await execute(db.pipeline() .collection("books") .select( field("name").trim().as("whitespaceTrimmedName") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("name").trim(" \n\t").as("whitespaceTrimmedName") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("name").trim().alias("whitespaceTrimmedName") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("name").trim().alias("whitespaceTrimmedName") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("name").trim().as_("whitespaceTrimmedName")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(trim(field("name")).as("whitespaceTrimmedName")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.Trim(firestore.FieldOf("name")).As("whitespaceTrimmedName"), )). Execute(ctx)
LTRIM
সিনট্যাক্স:
ltrim[T <: STRING | BYTES](value: T, to_trim: T) -> T
ltrim[T <: STRING | BYTES](value: T) -> T
বিবরণ:
প্রদত্ত value-এর শুরু থেকে BYTES বা CHARS-এর নির্দিষ্ট সেট ট্রিম করে।
to_trimপ্রদান করা না হলে, প্রথমের হোয়াইটস্পেস অক্ষর ট্রিম করে।
উদাহরণ:
to_trim উল্লেখ না করা থাকলে:
| মান | ltrim(value) |
|---|---|
| " foo " | "foo " |
| "foo" | "foo" |
to_trim প্রদান করা হলে:
| মান | to_trim | ltrim(value, to_trim) |
|---|---|---|
| "aaabc" | "a" | "bc" |
| "abacaba" | "ba" | "caba" |
| "é" | "é" | "" |
RTRIM
সিনট্যাক্স:
rtrim[T <: STRING | BYTES](value: T, to_trim: T) -> T
rtrim[T <: STRING | BYTES](value: T) -> T
বিবরণ:
প্রদান করা value-এর শেষ থেকে BYTES বা CHARS-এর নির্দিষ্ট সেট ট্রিম করে।
to_trimপ্রদান করা না হলে, ট্রেলিং হোয়াইটস্পেস অক্ষর ট্রিম করে।
উদাহরণ:
to_trim উল্লেখ না করা থাকলে:
| মান | rtrim(value) |
|---|---|
| " foo " | " foo" |
| "foo" | "foo" |
to_trim প্রদান করা হলে:
| মান | to_trim | rtrim(value, to_trim) |
|---|---|---|
| "abccc" | "c" | "ab" |
| "abacaba" | "ba" | "abac" |
| "é" | "é" | "" |
স্প্লিট
সিনট্যাক্স:
split(input: STRING) -> ARRAY<STRING>
split[T <: STRING | BYTES](input: T, delimiter: T) -> ARRAY<T>
বিবরণ:
ডিলিমিটার ব্যবহার করে STRING বা BYTES ভ্যালু স্প্লিট করে।
STRING-এর জন্য ডিফল্ট ডিলিমিটার হল কমা,। ডিলিমিটারকে একটি একক স্ট্রিং হিসেবে বিবেচনা করা হয়।BYTES-এর জন্য, আপনাকে অবশ্যই একটি ডিলিমিটার উল্লেখ করতে হবে।খালি ডিলিমিটারে স্প্লিট করলে
STRINGভ্যালুর জন্য ইউনিকোড কোডপয়েন্টের অ্যারে এবংBYTESভ্যালুর জন্যBYTES-এর অ্যারে তৈরি হয়।খালি
STRINGস্প্লিট করলে একটি খালিSTRINGসহARRAYপাওয়া যায়।
উদাহরণ:
delimiter উল্লেখ না করা থাকলে:
| ইনপুট | split(input) |
|---|---|
| "foo,bar,foo" | ["foo", "bar", "foo"] |
| "foo" | ["foo"] |
| ",foo," | ["", "foo", ""] |
| "" | [""] |
| b"C120C2C4" | ত্রুটি |
delimiter প্রদান করা হলে:
| ইনপুট | ডিলিমিটার | split(input, delimiter) |
|---|---|---|
| "foo bar foo" | " " | ["foo", "bar", "foo"] |
| "foo bar foo" | "z" | ["foo bar foo"] |
| "abc" | "" | ["a", "b", "c"] |
| b"C1,C2,C4" | b"," | [b"C1", b"C2", b"C4"] |
| b"ABC" | b"" | [b"A", b"B", b"C"] |
| "foo" | b"C1" | ত্রুটি |
টাইমস্ট্যাম্প ফাংশন
| নাম | বিবরণ |
CURRENT_TIMESTAMP
|
অনুরোধের সময় অনুযায়ী TIMESTAMP জেনারেট করে।
|
TIMESTAMP_TRUNC
|
প্রদত্ত গ্রানুলারিটিতে TIMESTAMP ট্রাঙ্কেট করে।
|
UNIX_MICROS_TO_TIMESTAMP
|
1970-01-01 00:00:00 UTC থেকে শুরু করে মাইক্রোসেকেন্ডের সংখ্যাকে TIMESTAMP-এ কনভার্ট করে
|
UNIX_MILLIS_TO_TIMESTAMP
|
1970-01-01 00:00:00 UTC থেকে শুরু করে মিলিসেকেন্ডের সংখ্যাকে TIMESTAMP-এ কনভার্ট করে
|
UNIX_SECONDS_TO_TIMESTAMP
|
1970-01-01 00:00:00 UTC থেকে শুরু করে সেকেন্ডের সংখ্যাকে TIMESTAMP-এ কনভার্ট করে
|
TIMESTAMP_ADD
|
TIMESTAMP-এ সময় বিরতি যোগ করে
|
TIMESTAMP_SUB
|
TIMESTAMP থেকে সময় বিরতি বিয়োগ করে
|
TIMESTAMP_TO_UNIX_MICROS
|
1970-01-01 00:00:00 UTC থেকে TIMESTAMP-কে মাইক্রোসেকেন্ডের সংখ্যায় কনভার্ট করে
|
TIMESTAMP_TO_UNIX_MILLIS
|
1970-01-01 00:00:00 UTC থেকে TIMESTAMP-কে মিলিসেকেন্ডের সংখ্যায় কনভার্ট করে
|
TIMESTAMP_TO_UNIX_SECONDS
|
1970-01-01 00:00:00 UTC থেকে শুরু করে TIMESTAMP-কে সেকেন্ডের সংখ্যায় কনভার্ট করে
|
TIMESTAMP_DIFF
|
দুটি TIMESTAMP-এর মধ্যে নির্দিষ্ট unit ব্যবধানের পূর্ণ সংখ্যা দেখায়।
|
TIMESTAMP_EXTRACT
|
TIMESTAMP থেকে নির্দিষ্ট part (যেমন, বছর, মাস, দিন) এক্সট্র্যাক্ট করে।
|
CURRENT_TIMESTAMP
সিনট্যাক্স:
current_timestamp() -> TIMESTAMP
বিবরণ:
অনুরোধের সময় input-এর শুরুতে টাইমস্ট্যাম্প পায় (1970-01-01 00:00:00 UTC থেকে শুরু করে মাইক্রোসেকেন্ডের
সংখ্যা হিসেবে ব্যাখ্যা করা হয়)।
এটি একটি কোয়েরির মধ্যে স্থিতিশীল এবং একাধিকবার কল করা হলে সর্বদা একই মান রিজলভ করবে।
TIMESTAMP_TRUNC
সিনট্যাক্স:
timestamp_trunc(timestamp: TIMESTAMP | BSON_TIMESTAMP, granularity: STRING[, timezone: STRING]) -> TIMESTAMP
বিবরণ:
প্রদত্ত গ্রানুলারিটি অনুযায়ী টাইমস্ট্যাম্প ট্রাঙ্কেট করে।
granularity আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
microsecondmillisecondsecondminutehourdayweekweek([weekday])monthquarteryearisoyear
timezone আর্গুমেন্ট প্রদান করা হলে, ট্রাঙ্কেশন প্রদত্ত টাইমজোনের ক্যালেন্ডার সীমানার উপর ভিত্তি করে হবে (যেমন, দিন ট্রাঙ্কেশন প্রদত্ত টাইমজোনে মধ্যরাতে ট্রাঙ্কেট করবে)। ডেলাইট সেভিংস টাইম অনুযায়ী ট্রাঙ্কেশন করা হবে।
timezone প্রদান করা না হলে, UTC ক্যালেন্ডার
সীমার উপর ভিত্তি করে ট্রাঙ্কেশন করা হবে।
timezone আর্গুমেন্টটি tz ডেটাবেস থেকে টাইমজোনের স্ট্রিং উপস্থাপনা হতে হবে, যেমন America/New_York। GMT থেকে অফসেট নির্দিষ্ট করে
কাস্টম টাইম অফসেটও ব্যবহার করা যেতে পারে।
উদাহরণ:
timestamp |
granularity |
timezone |
timestamp_trunc(timestamp, granularity, timezone) |
|---|---|---|---|
| 2000-01-01 10:20:30:123456 UTC | "সেকেন্ড" | উল্লেখ নেই | ২০০১-০১-০১ ১০:২০:৩০ UTC |
| ১৯৯৭-০৫-৩১ ০৪:৩০:৩০ UTC | "দিন" | উল্লেখ নেই | ১৯৯৭-০৫-৩১ ০০:০০:০০ UTC |
| ১৯৯৭-০৫-৩১ ০৪:৩০:৩০ UTC | "দিন" | "America/Los_Angeles" | ১৯৯৭-০৫-৩০ ০৭:০০:০০ UTC |
| ২০০১-০৩-১৬ ০৪:০০:০০ UTC | "week(friday) | উল্লেখ নেই | ২০০১-০৩-১৬ ০০:০০:০০ UTC |
| 2001-03-23 04:00:00 UTC | "week(friday) | "America/Los_Angeles" | 2001-03-23 17:00:00 UTC |
| ২৪-০১-২০২৬ ২০:০০:০০ UTC | "মাস" | "GMT+০৬:৩২:৪৩" | 2026-01-01T06:32:43 UTC |
UNIX_MICROS_TO_TIMESTAMP
সিনট্যাক্স:
unix_micros_to_timestamp(input: INT64) -> TIMESTAMP
বিবরণ:
input-কে (1970-01-01 00:00:00 UTC থেকে মাইক্রোসেকেন্ডের সংখ্যা হিসেবে ব্যাখ্যা করা হয়)
TIMESTAMP-এ কনভার্ট করে। input-কে সঠিক TIMESTAMP-এ কনভার্ট করা না গেলে
error থ্রো করে।
উদাহরণ:
input |
unix_micros_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ UTC |
| 400123456L | ১৯৭০-০১-০১ ০০:০৬:৪০.১২৩৪৫৬ UTC |
| -১০০০০০০L | ১৯৬৯-১২-৩১ ২৩:৫৯:৫৯ UTC |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtMicros").unixMicrosToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtMicros").unixMicrosToTimestamp().alias("createdAtString") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtMicros") .unix_micros_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixMicrosToTimestamp(field("createdAtMicros")).as("createdAtString")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.UnixMicrosToTimestamp(firestore.FieldOf("createdAtMicros")).As("createdAtString"), )). Execute(ctx)
UNIX_MILLIS_TO_TIMESTAMP
সিনট্যাক্স:
unix_millis_to_timestamp(input: INT64) -> TIMESTAMP
বিবরণ:
input-কে (1970-01-01 00:00:00 UTC থেকে শুরু করে মিলিসেকেন্ডের সংখ্যা হিসেবে ব্যাখ্যা করা হয়)
TIMESTAMP-এ কনভার্ট করে। input-কে সঠিক TIMESTAMP-এ কনভার্ট করা না গেলে
error থ্রো করে।
উদাহরণ:
input |
unix_millis_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ UTC |
| 4000123L | ১৯৭০-০১-০১ ০১:০৬:৪০.১২৩ UTC |
| -১০০০০০০L | ১৯৬৯-১২-৩১ ২৩:৪৩:২০ UTC |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtMillis").unixMillisToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtMillis").unixMillisToTimestamp().alias("createdAtString") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtMillis") .unix_millis_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixMillisToTimestamp(field("createdAtMillis")).as("createdAtString")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.UnixMillisToTimestamp(firestore.FieldOf("createdAtMillis")).As("createdAtString"), )). Execute(ctx)
UNIX_SECONDS_TO_TIMESTAMP
সিনট্যাক্স:
unix_seconds_to_timestamp(input: INT64) -> TIMESTAMP
বিবরণ:
input-কে (1970-01-01 00:00:00 UTC থেকে সেকেন্ডের সংখ্যা হিসেবে ব্যাখ্যা করা হয়)
TIMESTAMP-এ কনভার্ট করে। input-কে সঠিক TIMESTAMP-এ কনভার্ট করা না গেলে
error থ্রো করে।
উদাহরণ:
input |
unix_seconds_to_timestamp(input) |
|---|---|
| ০ লিটার | ১৯৭০-০১-০১ ০০:০০:০০ UTC |
| ৬০ লিটার | ১৯৭০-০১-০১ ০০:০১:০০ UTC |
| -৩০০ লিটার | ১৯৬৯-১২-৩১ ২৩:৫৫:০০ UTC |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAtSeconds").unixSecondsToTimestamp().as("createdAtString") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().alias("createdAtString") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAtSeconds").unixSecondsToTimestamp().alias("createdAtString") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("createdAtSeconds") .unix_seconds_to_timestamp() .as_("createdAtString") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(unixSecondsToTimestamp(field("createdAtSeconds")).as("createdAtString")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.UnixSecondsToTimestamp(firestore.FieldOf("createdAtSeconds")).As("createdAtString"), )). Execute(ctx)
TIMESTAMP_ADD
সিনট্যাক্স:
timestamp_add(timestamp: TIMESTAMP | BSON_TIMESTAMP, unit: STRING, amount: INT64) -> TIMESTAMP
বিবরণ:
timestamp থেকে unit-এর amount যোগ করে। amount আর্গুমেন্ট নেগেটিভ হতে পারে, সেক্ষেত্রে এটি TIMESTAMP_SUB-এর সমতুল্য।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
microsecondmillisecondsecondminutehourday
ফলাফল হিসেবে পাওয়া টাইমস্ট্যাম্প TIMESTAMP রেঞ্জের মধ্যে না থাকলে সমস্যা দেখায়।
উদাহরণ:
timestamp |
unit |
amount |
timestamp_add(timestamp, unit, amount) |
|---|---|---|---|
| ২০২৫-০২-২০ ০০:০০:০০ UTC | "মিনিট" | 2L | 2025-02-20 00:02:00 UTC |
| ২০২৫-০২-২০ ০০:০০:০০ UTC | "ঘণ্টা" | -4L | 2025-02-19 20:00:00 UTC |
| ২০২৫-০২-২০ ০০:০০:০০ UTC | "দিন" | ৫ লাখ | 2025-02-25 00:00:00 UTC |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).as("expiresAt") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).as("expiresAt") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("createdAt").timestampAdd(3653, .day).as("expiresAt") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("createdAt") .timestampAdd("day", 3653) .alias("expiresAt") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("createdAt").timestampAdd("day", 3653).alias("expiresAt") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("createdAt").timestamp_add("day", 3653).as_("expiresAt")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampAdd(field("createdAt"), "day", 3653).as("expiresAt")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.TimestampAdd(firestore.FieldOf("createdAt"), "day", 3653).As("expiresAt"), )). Execute(ctx)
TIMESTAMP_SUB
সিনট্যাক্স:
timestamp_sub(timestamp: TIMESTAMP | BSON_TIMESTAMP, unit: STRING, amount: INT64) -> TIMESTAMP
বিবরণ:
timestamp থেকে unit-এর amount বিয়োগ করে। amount আর্গুমেন্ট নেগেটিভ হতে পারে, সেক্ষেত্রে এটি TIMESTAMP_ADD-এর সমতুল্য।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
microsecondmillisecondsecondminutehourday
ফলাফল হিসেবে পাওয়া টাইমস্ট্যাম্প TIMESTAMP রেঞ্জের মধ্যে না থাকলে সমস্যা দেখায়।
উদাহরণ:
timestamp |
unit |
amount |
timestamp_sub(timestamp, unit, amount) |
|---|---|---|---|
| ২০২৬-০৭-০৪ ০০:০০:০০ UTC | "মিনিট" | ৪০ লিটার | 2026-07-03 23:20:00 UTC |
| ২০২৬-০৭-০৪ ০০:০০:০০ UTC | "ঘণ্টা" | -২৪L | ২০২৬-০৭-০৫ ০০:০০:০০ UTC |
| ২০২৬-০৭-০৪ ০০:০০:০০ UTC | "দিন" | ৩ লাখ | ২০২৬-০৭-০১ ০০:০০:০০ UTC |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).as("sendWarningTimestamp") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).as("sendWarningTimestamp") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("expiresAt").timestampSubtract(14, .day).as("sendWarningTimestamp") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("expiresAt") .timestampSubtract("day", 14) .alias("sendWarningTimestamp") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("expiresAt").timestampSubtract("day", 14).alias("sendWarningTimestamp") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select( Field.of("expiresAt") .timestamp_subtract("day", 14) .as_("sendWarningTimestamp") ) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampSubtract(field("expiresAt"), "day", 14).as("sendWarningTimestamp")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.TimestampSubtract(firestore.FieldOf("expiresAt"), "day", 14).As("sendWarningTimestamp"), )). Execute(ctx)
TIMESTAMP_TO_UNIX_MICROS
সিনট্যাক্স:
timestamp_to_unix_micros(input: TIMESTAMP | BSON_TIMESTAMP) -> INT64
বিবরণ:
1970-01-01 00:00:00 UTC থেকে input-কে মাইক্রোসেকেন্ডের সংখ্যায় কনভার্ট করে।
মাইক্রোসেকেন্ডের শুরুতে রাউন্ড ডাউন করে নির্ভুলতার উচ্চ লেভেল ট্রাঙ্কেট করে।
উদাহরণ:
input |
timestamp_to_unix_micros(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ UTC | ০ লিটার |
| ১৯৭০-০১-০১ ০০:০৬:৪০.১২৩৪৫৬ UTC | 400123456L |
| ১৯৬৯-১২-৩১ ২৩:৫৯:৫৯ UTC | -১০০০০০০L |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().as("unixMicros") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().as("unixMicros") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixMicros().as("unixMicros") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().alias("unixMicros") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMicros().alias("unixMicros") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_micros().as_("unixMicros")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixMicros(field("dateString")).as("unixMicros")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.TimestampToUnixMicros(firestore.FieldOf("dateString")).As("unixMicros"), )). Execute(ctx)
TIMESTAMP_TO_UNIX_MILLIS
সিনট্যাক্স:
timestamp_to_unix_millis(input: TIMESTAMP | BSON_TIMESTAMP) -> INT64
বিবরণ:
1970-01-01 00:00:00 UTC থেকে input-কে মিলিসেকেন্ডের সংখ্যায় কনভার্ট করে।
মিলি সেকেন্ডের শুরু পর্যন্ত রাউন্ড ডাউন করে নির্ভুলতার উচ্চ লেভেল ট্রাঙ্কেট করে।
উদাহরণ:
input |
timestamp_to_unix_millis(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ UTC | ০ লিটার |
| ১৯৭০-০১-০১ ০১:০৬:৪০.১২৩ UTC | 4000123L |
| ১৯৬৯-১২-৩১ ২৩:৪৩:২০ | -১০০০০০০L |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().as("unixMillis") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().as("unixMillis") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixMillis().as("unixMillis") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().alias("unixMillis") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixMillis().alias("unixMillis") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_millis().as_("unixMillis")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixMillis(field("dateString")).as("unixMillis")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.TimestampToUnixMillis(firestore.FieldOf("dateString")).As("unixMillis"), )). Execute(ctx)
TIMESTAMP_TO_UNIX_SECONDS
সিনট্যাক্স:
timestamp_to_unix_seconds(input: TIMESTAMP | BSON_TIMESTAMP) -> INT64
বিবরণ:
1970-01-01 00:00:00 UTC থেকে শুরু করে input-কে সেকেন্ডের সংখ্যায় কনভার্ট করে।
সেকেন্ডের শুরুতে রাউন্ড ডাউন করে নির্ভুলতার উচ্চ লেভেল ট্রাঙ্কেট করে।
উদাহরণ:
input |
timestamp_to_unix_seconds(input) |
|---|---|
| ১৯৭০-০১-০১ ০০:০০:০০ UTC | ০ লিটার |
| ১৯৭০-০১-০১ ০০:০১:০০ UTC | ৬০ লিটার |
| ১৯৬৯-১২-৩১ ২৩:৫৫:০০ UTC | -৩০০ লিটার |
Node.js
const result = await db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().as("unixSeconds") ) .execute();
Web
const result = await execute(db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().as("unixSeconds") ) );
Swift
let result = try await db.pipeline() .collection("documents") .select([ Field("dateString").timestampToUnixSeconds().as("unixSeconds") ]) .execute()
Kotlin
val result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().alias("unixSeconds") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("documents") .select( field("dateString").timestampToUnixSeconds().alias("unixSeconds") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("documents") .select(Field.of("dateString").timestamp_to_unix_seconds().as_("unixSeconds")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("documents") .select(timestampToUnixSeconds(field("dateString")).as("unixSeconds")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("documents"). Select(firestore.Fields( firestore.TimestampToUnixSeconds(firestore.FieldOf("dateString")).As("unixSeconds"), )). Execute(ctx)
TIMESTAMP_DIFF
সিনট্যাক্স:
timestamp_diff(end: TIMESTAMP | BSON_TIMESTAMP, start: TIMESTAMP | BSON_TIMESTAMP, unit: STRING) -> INT64
বিবরণ:
দুটি TIMESTAMP-এর মধ্যে নির্দিষ্ট unit ব্যবধানের পূর্ণ সংখ্যা দেখায়।
end,start-এর আগে হলে নেগেটিভ ভ্যালু দেখায়।- যেকোনও ভগ্নাংশ ইউনিটকে ট্রাঙ্কেট করে। যেমন,
timestamp_diff("2021-01-01 00:00:01", "2021-01-01 00:00:00", "minute")-এর জন্য0রিটার্ন করে।
unit আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
microsecondmillisecondsecondminutehourday
উদাহরণ:
end |
start |
unit |
timestamp_diff(end, start, unit) |
|---|---|---|---|
| ২০২৬-০৭-০৪ ০০:০১:০০ UTC | ২০২৬-০৭-০৪ ০০:০০:০০ UTC | "সেকেন্ড" | ৬০ লিটার |
| ২০২৬-০৭-০৪ ০০:০০:০০ UTC | ২০২৬-০৭-০৫ ০০:০০:০০ UTC | "দিন" | -১ লিটার |
| ২০২৬-০৭-০৪ ০০:০০:৫৯ UTC | ২০২৬-০৭-০৪ ০০:০০:০০ UTC | "মিনিট" | ০ লিটার |
TIMESTAMP_EXTRACT
সিনট্যাক্স:
timestamp_extract(timestamp: TIMESTAMP | BSON_TIMESTAMP, part: STRING[, timezone: STRING]) -> INT64
বিবরণ:
timestamp থেকে নির্দিষ্ট part (যেমন, বছর, মাস, দিন) এক্সট্র্যাক্ট করে।
part আর্গুমেন্টটি অবশ্যই একটি স্ট্রিং এবং নিম্নলিখিতগুলির মধ্যে একটি হতে হবে:
microsecondmillisecondsecondminutehourdaydayofweek: ১ (রবিবার) থেকে ৭ (শনিবার)-এর মধ্যে কোনও ভ্যালু দেখায়।dayofyearweek: বছরের সপ্তাহের সংখ্যা দেখায়, বছরের প্রথম রবিবার থেকে ১ দিয়ে শুরু হয়।week([weekday]): নির্দিষ্টweekdayথেকে শুরু করে বছরের সপ্তাহের সংখ্যা দেখায়।monthquarteryearisoweek: ISO 8601 সপ্তাহের সংখ্যা দেখায়।isoyear: ISO 8601 সপ্তাহ-নম্বরিং বছর রিটার্ন করে।
timezone আর্গুমেন্ট প্রদান করা হলে, এক্সট্র্যাকশন প্রদত্ত টাইমজোনের ক্যালেন্ডারের উপর ভিত্তি করে হবে। এক্সট্র্যাকশন ডেলাইট সেভিংস টাইম মেনে চলবে।
timezone প্রদান করা না হলে, UTC-এর উপর ভিত্তি করে এক্সট্র্যাক্ট করা হবে।
timezone আর্গুমেন্টটি টাইমজোন ডেটাবেস থেকে টাইমজোনের একটি স্ট্রিং উপস্থাপনা হওয়া উচিত, উদাহরণস্বরূপ America/New_York। এছাড়াও, GMT থেকে অফসেট নির্দিষ্ট করে
কাস্টম টাইম অফসেট ব্যবহার করা যেতে পারে।
উদাহরণ:
timestamp |
part |
timezone |
timestamp_extract(timestamp, part, timezone) |
|---|---|---|---|
| ২০২৫-০২-২০ ১০:২০:৩০ UTC | "বছর" | উল্লেখ নেই | ২০২৫ |
| ২০২৫-০২-২০ ১০:২০:৩০ UTC | "দিন" | উল্লেখ নেই | 20 |
| ২০২৫-১২-৩১ ২৩:৫৯:৫৯ UTC | "বছর" | "Asia/Tokyo" | 2026 |
ফাংশন টাইপ করুন
| নাম | বিবরণ |
TYPE
|
STRING হিসেবে ভ্যালুর ধরন দেখায়।
|
IS_TYPE
|
ভ্যালু নির্দিষ্ট ধরনের সাথে মিললে true দেখায়।
|
প্রকার
সিনট্যাক্স:
type(input: ANY) -> STRING
বিবরণ:
input ধরনের স্ট্রিং উপস্থাপনা দেখায়।
অনুপস্থিত ভ্যালু দেওয়া হলে, NULL দেখায়।
উদাহরণ:
input |
type(input) |
|---|---|
| NULL | "null" |
| সত্য | "boolean" |
| 1 | "int32" |
| -৩L | "int64" |
| ৩.১৪ | "float64" |
| 2024-01-01T00:00:00Z UTC | "timestamp" |
| "foo" | "string" |
| b"foo" | "bytes" |
| [১, ২] | "array" |
| {"a": 1} | "map" |
path("c/d") |
"reference" |
vector([1.0, 2.0]) |
"vector" |
object_id "a7f2c9d18b3e4509f67c12d8" |
"object_id" |
1.2e9m |
"decimal128" |
regex "/pattern/i" |
"regex" |
bson_timestamp(1732754912, 500) |
"bson_timestamp" |
| অনুপস্থিত | 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();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.NotEqual(firestore.FieldOf("title"), "1984").As("not1984"), )). Execute(ctx)
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" | সত্য |
| সত্য | "বুলিয়ান" | সত্য |
| ৩.১৪ | "float64" | সত্য |
| "foo" | "স্ট্রিং" | সত্য |
| b"foo" | "স্ট্রিং" | মিথ্যা |
| [১, ২] | "অ্যারে" | সত্য |
| {"a": 1} | "ম্যাপ" | সত্য |
vector([1.0, 2.0]) |
"ভেক্টর" | সত্য |
| অনুপস্থিত | "স্ট্রিং" | NULL |
| "বার" | "অন্য" | সমস্যা |
ভেক্টর ফাংশন
| নাম | বিবরণ |
COSINE_DISTANCE
|
দুটি ভেক্টরের মধ্যে কোসাইন দূরত্ব দেখায় |
DOT_PRODUCT
|
দুটি ভেক্টরের ডট প্রোডাক্ট দেখায় |
EUCLIDEAN_DISTANCE
|
দুটি ভেক্টরের মধ্যে ইউক্লিডিয়ান দূরত্ব দেখায় |
MANHATTAN_DISTANCE
|
দুটি ভেক্টরের মধ্যে ম্যানহাটন দূরত্ব দেখায় |
VECTOR_LENGTH
|
ভেক্টরে থাকা এলিমেন্টের সংখ্যা দেখায় |
COSINE_DISTANCE
সিনট্যাক্স:
cosine_distance(x: VECTOR, y: VECTOR) -> FLOAT64
বিবরণ:
x এবং y-এর মধ্যে কোসাইন দূরত্ব রিটার্ন করে।
Node.js
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await db.pipeline() .collection("books") .select( field("embedding").cosineDistance(sampleVector).as("cosineDistance") ) .execute();
Web
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await execute(db.pipeline() .collection("books") .select( field("embedding").cosineDistance(sampleVector).as("cosineDistance")));
Swift
let sampleVector = [0.0, 1, 2, 3, 4, 5] let result = try await db.pipeline() .collection("books") .select([ Field("embedding").cosineDistance(sampleVector).as("cosineDistance") ]) .execute()
Kotlin
val sampleVector = doubleArrayOf(0.0, 1.0, 2.0, 3.0, 4.0, 5.0) val result = db.pipeline() .collection("books") .select( field("embedding").cosineDistance(sampleVector).alias("cosineDistance") ) .execute()
Java
double[] sampleVector = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("embedding").cosineDistance(sampleVector).alias("cosineDistance") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field from google.cloud.firestore_v1.vector import Vector sample_vector = Vector([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) result = ( client.pipeline() .collection("books") .select( Field.of("embedding").cosine_distance(sample_vector).as_("cosineDistance") ) .execute() )
জাভা
double[] sampleVector = new double[] {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(cosineDistance(field("embedding"), sampleVector).as("cosineDistance")) .execute() .get();
Go
sampleVector := []float64{0.0, 1.0, 2.0, 3.0, 4.0, 5.0} snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.CosineDistance(firestore.FieldOf("embedding"), sampleVector).As("cosineDistance"), )). Execute(ctx)
DOT_PRODUCT
সিনট্যাক্স:
dot_product(x: VECTOR, y: VECTOR) -> FLOAT64
বিবরণ:
x ও y-এর ডট প্রোডাক্ট দেখায়।
Node.js
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await db.pipeline() .collection("books") .select( field("embedding").dotProduct(sampleVector).as("dotProduct") ) .execute();
Web
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await execute(db.pipeline() .collection("books") .select( field("embedding").dotProduct(sampleVector).as("dotProduct") ) );
Swift
let sampleVector = [0.0, 1, 2, 3, 4, 5] let result = try await db.pipeline() .collection("books") .select([ Field("embedding").dotProduct(sampleVector).as("dotProduct") ]) .execute()
Kotlin
val sampleVector = doubleArrayOf(0.0, 1.0, 2.0, 3.0, 4.0, 5.0) val result = db.pipeline() .collection("books") .select( field("embedding").dotProduct(sampleVector).alias("dotProduct") ) .execute()
Java
double[] sampleVector = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("embedding").dotProduct(sampleVector).alias("dotProduct") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field from google.cloud.firestore_v1.vector import Vector sample_vector = Vector([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) result = ( client.pipeline() .collection("books") .select(Field.of("embedding").dot_product(sample_vector).as_("dotProduct")) .execute() )
জাভা
double[] sampleVector = new double[] {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(dotProduct(field("embedding"), sampleVector).as("dotProduct")) .execute() .get();
Go
sampleVector := []float64{0.0, 1.0, 2.0, 3.0, 4.0, 5.0} snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.DotProduct(firestore.FieldOf("embedding"), sampleVector).As("dotProduct"), )). Execute(ctx)
EUCLIDEAN_DISTANCE
সিনট্যাক্স:
euclidean_distance(x: VECTOR, y: VECTOR) -> FLOAT64
বিবরণ:
x এবং y-এর মধ্যে ইউক্লিডিয়ান দূরত্ব গণনা করে।
Node.js
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await db.pipeline() .collection("books") .select( field("embedding").euclideanDistance(sampleVector).as("euclideanDistance") ) .execute();
Web
const sampleVector = [0.0, 1, 2, 3, 4, 5]; const result = await execute(db.pipeline() .collection("books") .select( field("embedding").euclideanDistance(sampleVector).as("euclideanDistance") ) );
Swift
let sampleVector = [0.0, 1, 2, 3, 4, 5] let result = try await db.pipeline() .collection("books") .select([ Field("embedding").euclideanDistance(sampleVector).as("euclideanDistance") ]) .execute()
Kotlin
val sampleVector = doubleArrayOf(0.0, 1.0, 2.0, 3.0, 4.0, 5.0) val result = db.pipeline() .collection("books") .select( field("embedding").euclideanDistance(sampleVector).alias("euclideanDistance") ) .execute()
Java
double[] sampleVector = {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("embedding").euclideanDistance(sampleVector).alias("euclideanDistance") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field from google.cloud.firestore_v1.vector import Vector sample_vector = Vector([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) result = ( client.pipeline() .collection("books") .select( Field.of("embedding") .euclidean_distance(sample_vector) .as_("euclideanDistance") ) .execute() )
জাভা
double[] sampleVector = new double[] {0.0, 1.0, 2.0, 3.0, 4.0, 5.0}; Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(euclideanDistance(field("embedding"), sampleVector).as("euclideanDistance")) .execute() .get();
Go
sampleVector := []float64{0.0, 1.0, 2.0, 3.0, 4.0, 5.0} snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.EuclideanDistance(firestore.FieldOf("embedding"), sampleVector).As("euclideanDistance"), )). Execute(ctx)
MANHATTAN_DISTANCE
সিনট্যাক্স:
manhattan_distance(x: VECTOR, y: VECTOR) -> FLOAT64
বিবরণ:
x এবং y-এর মধ্যে ম্যানহাটন দূরত্ব গণনা করে।
VECTOR_LENGTH
সিনট্যাক্স:
vector_length(vector: VECTOR) -> INT64
বিবরণ:
VECTOR-এ এলিমেন্টের সংখ্যা দেখায়।
Node.js
const result = await db.pipeline() .collection("books") .select( field("embedding").vectorLength().as("vectorLength") ) .execute();
Web
const result = await execute(db.pipeline() .collection("books") .select( field("embedding").vectorLength().as("vectorLength") ) );
Swift
let result = try await db.pipeline() .collection("books") .select([ Field("embedding").vectorLength().as("vectorLength") ]) .execute()
Kotlin
val result = db.pipeline() .collection("books") .select( field("embedding").vectorLength().alias("vectorLength") ) .execute()
Java
Task<Pipeline.Snapshot> result = db.pipeline() .collection("books") .select( field("embedding").vectorLength().alias("vectorLength") ) .execute();
Python
from google.cloud.firestore_v1.pipeline_expressions import Field result = ( client.pipeline() .collection("books") .select(Field.of("embedding").vector_length().as_("vectorLength")) .execute() )
জাভা
Pipeline.Snapshot result = firestore .pipeline() .collection("books") .select(vectorLength(field("embedding")).as("vectorLength")) .execute() .get();
Go
snapshot := client.Pipeline(). Collection("books"). Select(firestore.Fields( firestore.VectorLength(firestore.FieldOf("embedding")).As("vectorLength"), )). Execute(ctx)