सामान्य फ़ंक्शन
| नाम | ब्यौरा |
CURRENT_DOCUMENT
|
पाइपलाइन में फ़िलहाल प्रोसेस किए जा रहे दस्तावेज़ को दिखाता है. |
CONCAT
|
एक ही टाइप की दो या उससे ज़्यादा वैल्यू को जोड़ता है. |
LENGTH
|
String, Bytes, Array, Vector या Map की लंबाई का हिसाब लगाता है.
|
REVERSE
|
String, Bytes या Array को उलटता है.
|
CURRENT_DOCUMENT
सिंटैक्स:
current_document() -> MAP
Description:
यह ऐसे मैप की वैल्यू दिखाता है जिसमें मौजूदा स्कोप में तय किए गए सभी फ़ील्ड शामिल होते हैं. यह तब काम आता है, जब एक से ज़्यादा दस्तावेज़ों को मर्ज या इकट्ठा किया जाता है या जब दस्तावेज़ में फ़ील्ड के नामों की डाइनैमिक तरीके से जांच करनी होती है.
उदाहरण के लिए, किसी फ़ील्ड के हिसाब से ग्रुप किए गए दस्तावेज़ों की सूची पाने के लिए:
Node.js
const cities = await db.pipeline()
.collection("/restaurants")
.aggregate({
groups: [ field("location.state").as("state") ],
accumulators: [ arrayAgg(currentDocument().as("restaurants")) ]
})
.execute();
CONCAT
सिंटैक्स:
concat[T <: STRING | BYTES | ARRAY](values:T ...) -> T
Description:
एक ही टाइप की दो या उससे ज़्यादा वैल्यू को जोड़ता है.
उदाहरण:
| values | concat(values) |
|---|---|
| "abc", "def" | "abcdef" |
| [1, 2], [3, 4] | [1, 2, 3, 4] |
| b"abc", b"def" | b"abcdef" |
| "abc", [1,2,3], "ghi" | गड़बड़ी |
| [1,2,3] | गड़बड़ी |
| "abc", null | शून्य |
Node.js
concat(constant("Author ID: "), field("authorId"));
Web
concat(constant("Author ID: "), field("authorId"));
Swift
let displayString = Constant("Author ID: ").concat([Field("authorId")])
Kotlin
val displayString = constant("Author ID: ").concat(field("authorId"))
Java
Expression displayString = constant("Author ID: ").concat(field("authorId"));
Python
Constant.of("Author ID: ").concat(Field.of("authorId"))
लंबाई
सिंटैक्स:
length[T <: STRING | BYTES | ARRAY | VECTOR | MAP](value: T) -> INT64
Description:
String, Bytes, Array, Vector या Map वैल्यू की लंबाई का हिसाब लगाता है.
उदाहरण:
| value | length(value) |
|---|---|
| "hello" | 5 |
| [1, 2, 3, 4] | 4 |
| b"abcde" | 5 |
| null | null |
| 1 | गड़बड़ी |
REVERSE
सिंटैक्स:
reverse[T <: STRING | BYTES | ARRAY](value: T) -> T
Description:
String, Bytes या Array वैल्यू को उलटता है.
उदाहरण:
| value | reverse(value) |
|---|---|
| "hello" | "olleh" |
| [1, 2, 3] | [3, 2, 1] |
| b"abc" | b"cba" |
| 23 | गड़बड़ी |
| null | null |