Cloud Functions की मदद से Cloud Firestore का दायरा बढ़ाना (2nd gen)

Cloud Functions की मदद से, ट्रिगर किए गए इवेंट को हैंडल करने के लिए कोड डिप्लॉय किया जा सकता है के हिसाब से काम करते हैं. इससे आपको आसानी से सर्वर साइड जोड़ने की सुविधा मिलती है और ऐप्लिकेशन की मुख्य सुविधाओं और उनके काम करने के तरीके का पता लगाने के लिए किया जा सकता है.

Cloud Functions (2nd gen)

Cloud Run की मदद से और इवेंटर्क, Firebase के लिए Cloud Functions (2nd gen) आपको ज़्यादा असरदार इन्फ़्रास्ट्रक्चर, परफ़ॉर्मेंस और बड़े स्तर पर इस्तेमाल करने पर बेहतर कंट्रोल वगैरह फ़ंक्शन के रनटाइम को कंट्रोल करने की सुविधा मिलती है. 2nd gen के बारे में ज़्यादा जानकारी के लिए, यहां देखें Firebase के लिए Cloud Functions (2nd gen). ज़्यादा देखने के लिए इसके बजाय, 1st gen के बारे में जानें. Cloud Functions की मदद से Cloud Firestore का विस्तार करना.

Cloud Firestore फ़ंक्शन ट्रिगर

'Firebase के लिए Cloud Functions' SDK टूल, नीचे दिए गए Cloud Firestore को एक्सपोर्ट करता है इवेंट ट्रिगर ताकि आप खास Cloud Firestore से जुड़े हैंडलर बना सकें इवेंट:

Node.js

इवेंट टाइप ट्रिगर
onDocumentCreated तब ट्रिगर होता है, जब किसी दस्तावेज़ को पहली बार लिखा जाता है.
onDocumentUpdated तब ट्रिगर होता है, जब कोई दस्तावेज़ पहले से मौजूद होता है और उसकी वैल्यू में कोई बदलाव होता है.
onDocumentDeleted तब ट्रिगर होता है, जब कोई दस्तावेज़ मिटा दिया जाता है.
onDocumentWritten onDocumentCreated, onDocumentUpdated या onDocumentDeleted के ट्रिगर होने पर ट्रिगर होता है.
onDocumentCreatedWithAuthContext पुष्टि करने की ज़्यादा जानकारी के साथ onDocumentCreated
onDocumentWrittenWithAuthContext पुष्टि करने की ज़्यादा जानकारी के साथ onDocumentWritten
onDocumentDeletedWithAuthContext पुष्टि करने की ज़्यादा जानकारी के साथ onDocumentDeleted
onDocumentUpdatedWithAuthContext पुष्टि करने की ज़्यादा जानकारी के साथ onDocumentUpdated

Python (preview)

इवेंट टाइप ट्रिगर
on_document_created तब ट्रिगर होता है, जब किसी दस्तावेज़ को पहली बार लिखा जाता है.
on_document_updated तब ट्रिगर होता है, जब कोई दस्तावेज़ पहले से मौजूद होता है और उसकी वैल्यू में कोई बदलाव होता है.
on_document_deleted तब ट्रिगर होता है, जब कोई दस्तावेज़ मिटा दिया जाता है.
on_document_written on_document_created, on_document_updated या on_document_deleted के ट्रिगर होने पर ट्रिगर होता है.
on_document_created_with_auth_context पुष्टि करने की ज़्यादा जानकारी के साथ on_document_created
on_document_updated_with_auth_context पुष्टि करने की ज़्यादा जानकारी के साथ on_document_updated
on_document_deleted_with_auth_context पुष्टि करने की ज़्यादा जानकारी के साथ on_document_deleted
on_document_written_with_auth_context पुष्टि करने की ज़्यादा जानकारी के साथ on_document_written

Cloud Firestore इवेंट सिर्फ़ ट्रिगर होते हैं दस्तावेज़ में किए गए बदलावों के बारे में ज़्यादा जानें. Cloud Firestore दस्तावेज़ के लिए अपडेट, जिसमें डेटा नहीं बदला है (नो-ऑप राइटिंग) किसी अपडेट या लेखन इवेंट को जनरेट नहीं करता. हां खास फ़ील्ड में इवेंट नहीं जोड़े जा सकते.

अगर आपने अभी तक Cloud Functions for Firebase के लिए कोई प्रोजेक्ट चालू नहीं किया है, तो पढ़ें Firebase के लिए Cloud Functions का इस्तेमाल शुरू करना (2nd gen) Firebase प्रोजेक्ट के लिए अपने Cloud Functions को कॉन्फ़िगर और सेट अप करें.

Cloud Firestore से ट्रिगर होने वाले फ़ंक्शन लिखना

फ़ंक्शन ट्रिगर तय करना

Cloud Firestore ट्रिगर तय करने के लिए, दस्तावेज़ का पाथ और इवेंट टाइप तय करें:

Node.js

import {
  onDocumentWritten,
  onDocumentCreated,
  onDocumentUpdated,
  onDocumentDeleted,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.myfunction = onDocumentWritten("my-collection/{docId}", (event) => {
   /* ... */ 
});

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_created,
  on_document_deleted,
  on_document_updated,
  on_document_written,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_created(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot]) -> None:

दस्तावेज़ के पाथ में किसी खास दस्तावेज़ का रेफ़रंस दिया जा सकता है या वाइल्डकार्ड पैटर्न शामिल हो.

कोई एक दस्तावेज़ तय करें

अगर आपको किसी खास दस्तावेज़ में किसी भी बदलाव को ट्रिगर करने के लिए इवेंट ट्रिगर करना है, तो नीचे दिए गए फ़ंक्शन का इस्तेमाल किया जा सकता है.

Node.js

import {
  onDocumentWritten,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.myfunction = onDocumentWritten("users/marie", (event) => {
  // Your code here
});

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_written,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_written(document="users/marie")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:

वाइल्डकार्ड का इस्तेमाल करके दस्तावेज़ों का एक ग्रुप बनाएं

अगर आपको दस्तावेज़ों के ग्रुप में ट्रिगर अटैच करना है, जैसे कि तो किसी खास कलेक्शन की जगह पर {wildcard} का इस्तेमाल करें दस्तावेज़ आईडी:

Node.js

import {
  onDocumentWritten,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.myfunction = onDocumentWritten("users/{userId}", (event) => {
  // If we set `/users/marie` to {name: "Marie"} then
  // event.params.userId == "marie"
  // ... and ...
  // event.data.after.data() == {name: "Marie"}
});

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_written,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_written(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
  # If we set `/users/marie` to {name: "Marie"} then
  event.params["userId"] == "marie"  # True
  # ... and ...
  event.data.after.to_dict() == {"name": "Marie"}  # True

इस उदाहरण में, जब users में किसी भी दस्तावेज़ पर कोई भी फ़ील्ड बदला जाता है, तो वह मेल खाता है userId नाम का वाइल्डकार्ड.

अगर users के किसी दस्तावेज़ में सब-कलेक्शन है और उनमें से किसी एक में कोई फ़ील्ड है उप-संग्रह दस्तावेज़ों में बदलाव किया गया है, userId वाइल्डकार्ड ट्रिगर नहीं किया गया है.

वाइल्डकार्ड से मेल खाने वाले नतीजे, दस्तावेज़ के पाथ से हासिल किए जाते हैं और event.params में सेव किए जाते हैं. अश्लील कलेक्शन वाले विकल्प के लिए, जितने चाहें उतने वाइल्डकार्ड तय किए जा सकते हैं दस्तावेज़ आईडी या दस्तावेज़ आईडी:

Node.js

import {
  onDocumentWritten,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.myfunction = onDocumentWritten("users/{userId}/{messageCollectionId}/{messageId}", (event) => {
    // If we set `/users/marie/incoming_messages/134` to {body: "Hello"} then
    // event.params.userId == "marie";
    // event.params.messageCollectionId == "incoming_messages";
    // event.params.messageId == "134";
    // ... and ...
    // event.data.after.data() == {body: "Hello"}
});

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_written,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_written(document="users/{userId}/{messageCollectionId}/{messageId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
  # If we set `/users/marie/incoming_messages/134` to {body: "Hello"} then
  event.params["userId"] == "marie"  # True
  event.params["messageCollectionId"] == "incoming_messages"  # True
  event.params["messageId"] == "134"  # True
  # ... and ...
  event.data.after.to_dict() == {"body": "Hello"}

आपका ट्रिगर हमेशा किसी दस्तावेज़ पर ले जाना चाहिए, भले ही आप वाइल्डकार्ड का इस्तेमाल कर रहे हों. उदाहरण के लिए, users/{userId}/{messageCollectionId} मान्य नहीं है, क्योंकि {messageCollectionId} एक संग्रह है. हालांकि, users/{userId}/{messageCollectionId}/{messageId} है मान्य है क्योंकि {messageId} हमेशा किसी दस्तावेज़ पर ले जाएगा.

इवेंट ट्रिगर

नया दस्तावेज़ बनाए जाने पर फ़ंक्शन ट्रिगर करें

कलेक्शन में नया दस्तावेज़ बनाए जाने पर, किसी भी फ़ंक्शन को ऐक्टिव करने के लिए ट्रिगर किया जा सकता है. जब भी किसी नए उपयोगकर्ता की प्रोफ़ाइल जोड़ी जाती है, तब यह उदाहरण फ़ंक्शन ट्रिगर होता है:

Node.js

import {
  onDocumentCreated,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.createuser = onDocumentCreated("users/{userId}", (event) => {
    // Get an object representing the document
    // e.g. {'name': 'Marie', 'age': 66}
    const snapshot = event.data;
    if (!snapshot) {
        console.log("No data associated with the event");
        return;
    }
    const data = snapshot.data();

    // access a particular field as you would any JS property
    const name = data.name;

    // perform more operations ...
});

पुष्टि करने से जुड़ी ज़्यादा जानकारी के लिए, onDocumentCreatedWithAuthContext का इस्तेमाल करें.

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_created,
  Event,
  DocumentSnapshot,
)

@on_document_created(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot]) -> None:
  # Get a dictionary representing the document
  # e.g. {'name': 'Marie', 'age': 66}
  new_value = event.data.to_dict()

  # Access a particular field as you would any dictionary
  name = new_value["name"]

  # Perform more operations ...

दस्तावेज़ के अपडेट होने पर फ़ंक्शन ट्रिगर करें

दस्तावेज़ के अपडेट होने पर, फ़ंक्शन को ऐक्टिव करने के लिए भी ट्रिगर किया जा सकता है. यह उदाहरण फ़ंक्शन तब सक्रिय होता है, जब कोई उपयोगकर्ता अपनी प्रोफ़ाइल बदलता है:

Node.js

import {
  onDocumentUpdated,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.updateuser = onDocumentUpdated("users/{userId}", (event) => {
    // Get an object representing the document
    // e.g. {'name': 'Marie', 'age': 66}
    const newValue = event.data.after.data();

    // access a particular field as you would any JS property
    const name = newValue.name;

    // perform more operations ...
});

पुष्टि करने से जुड़ी ज़्यादा जानकारी के लिए, onDocumentUpdatedWithAuthContext का इस्तेमाल करें.

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_updated,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
  # Get a dictionary representing the document
  # e.g. {'name': 'Marie', 'age': 66}
  new_value = event.data.after.to_dict()

  # Access a particular field as you would any dictionary
  name = new_value["name"]

  # Perform more operations ...

दस्तावेज़ मिटाए जाने पर फ़ंक्शन ट्रिगर करें

किसी दस्तावेज़ के मिटाए जाने पर भी फ़ंक्शन को ट्रिगर किया जा सकता है. यह उदाहरण जब कोई उपयोगकर्ता अपनी प्रोफ़ाइल मिटाता है, तो फ़ंक्शन ट्रिगर होता है:

Node.js

import {
  onDocumentDeleted,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.deleteuser = onDocumentDeleted("users/{userId}", (event) => {
    // Get an object representing the document
    // e.g. {'name': 'Marie', 'age': 66}
    const snap =  event.data;
    const data =  snap.data();

    // perform more operations ...
});

पुष्टि करने से जुड़ी ज़्यादा जानकारी के लिए, onDocumentDeletedWithAuthContext का इस्तेमाल करें.

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_deleted,
  Event,
  DocumentSnapshot,
)

@on_document_deleted(document="users/{userId}")
def myfunction(event: Event[DocumentSnapshot|None]) -> None:
  # Perform more operations ...

किसी दस्तावेज़ में सभी बदलावों के लिए फ़ंक्शन ट्रिगर करना

अगर आपको ट्रिगर होने वाले इवेंट के बारे में कोई जानकारी नहीं है, तो यहां मौजूद सभी "लिखे गए दस्तावेज़" का इस्तेमाल करके, Cloud Firestore दस्तावेज़ में बदलाव किए गए हैं इवेंट ट्रिगर होना चाहिए. यह उदाहरण फ़ंक्शन तब सक्रिय होता है, जब कोई उपयोगकर्ता बनाया जाता है, अपडेट किया जाता है या हटाया जाता है:

Node.js

import {
  onDocumentWritten,
  Change,
  FirestoreEvent
} from "firebase-functions/v2/firestore";

exports.modifyuser = onDocumentWritten("users/{userId}", (event) => {
    // Get an object with the current document values.
    // If the document does not exist, it was deleted
    const document =  event.data.after.data();

    // Get an object with the previous document values
    const previousValues =  event.data.before.data();

    // perform more operations ...
});

पुष्टि करने से जुड़ी ज़्यादा जानकारी के लिए, onDocumentWrittenWithAuthContext का इस्तेमाल करें.

Python (preview)

from firebase_functions.firestore_fn import (
  on_document_written,
  Event,
  Change,
  DocumentSnapshot,
)

@on_document_written(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot | None]]) -> None:
  # Get an object with the current document values.
  # If the document does not exist, it was deleted.
  document = (event.data.after.to_dict()
              if event.data.after is not None else None)

  # Get an object with the previous document values.
  # If the document does not exist, it was newly created.
  previous_values = (event.data.before.to_dict()
                     if event.data.before is not None else None)

  # Perform more operations ...

डेटा को पढ़ने और लिखने की सुविधा

जब कोई फ़ंक्शन ट्रिगर किया जाता है, तो यह इवेंट. इस स्नैपशॉट का इस्तेमाल, उस दस्तावेज़ से पढ़ने या उसमें लिखने के लिए किया जा सकता है जिसमें इवेंट ट्रिगर किया है या दूसरे हिस्सों को ऐक्सेस करने के लिए Firebase एडमिन SDK का इस्तेमाल किया जा सकता है आपके डेटाबेस का ऐसा होना चाहिए.

इवेंट का डेटा

पढ़ने से जुड़ा डेटा

जब कोई फ़ंक्शन ट्रिगर होता है, तो हो सकता है कि आप ऐसे दस्तावेज़ से डेटा लेना चाहें जो को अपडेट किया गया हो या अपडेट से पहले का डेटा मिले. पुराना डेटा पाने के लिए, इनका इस्तेमाल करें: event.data.before में अपडेट से पहले का दस्तावेज़ का स्नैपशॉट होता है. इसी तरह, event.data.after में दस्तावेज़ के स्नैपशॉट की स्थिति, अपडेट.

Node.js

exports.updateuser2 = onDocumentUpdated("users/{userId}", (event) => {
    // Get an object with the current document values.
    // If the document does not exist, it was deleted
    const newValues =  event.data.after.data();

    // Get an object with the previous document values
    const previousValues =  event.data.before.data();
});

Python (preview)

@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
  # Get an object with the current document values.
  new_value = event.data.after.to_dict()

  # Get an object with the previous document values.
  prev_value = event.data.before.to_dict()

प्रॉपर्टी को उसी तरह ऐक्सेस किया जा सकता है जैसे किसी दूसरे ऑब्जेक्ट में किया जाता है. इसके अलावा, आपके पास कुछ खास फ़ील्ड को ऐक्सेस करने के लिए, get फ़ंक्शन का इस्तेमाल किया जा सकता है:

Node.js

// Fetch data using standard accessors
const age = event.data.after.data().age;
const name = event.data.after.data()['name'];

// Fetch data using built in accessor
const experience = event.data.after.data.get('experience');

Python (preview)

# Get the value of a single document field.
age = event.data.after.get("age")

# Convert the document to a dictionary.
age = event.data.after.to_dict()["age"]

डेटा राइट किया जा रहा है

हर फ़ंक्शन को शुरू करने की कार्रवाई, आपके Cloud Firestore डेटाबेस. आप उस दस्तावेज़ को यहां ऐक्सेस कर सकते हैं आपके फ़ंक्शन पर वापस भेजा गया स्नैपशॉट.

दस्तावेज़ के रेफ़रंस में update(), set(), और remove() जैसे तरीके शामिल होते हैं ताकि आप फ़ंक्शन को ट्रिगर करने वाले दस्तावेज़ में बदलाव कर सकें.

Node.js

import { onDocumentUpdated } from "firebase-functions/v2/firestore";

exports.countnamechanges = onDocumentUpdated('users/{userId}', (event) => {
  // Retrieve the current and previous value
  const data = event.data.after.data();
  const previousData = event.data.before.data();

  // We'll only update if the name has changed.
  // This is crucial to prevent infinite loops.
  if (data.name == previousData.name) {
    return null;
  }

  // Retrieve the current count of name changes
  let count = data.name_change_count;
  if (!count) {
    count = 0;
  }

  // Then return a promise of a set operation to update the count
  return data.after.ref.set({
    name_change_count: count + 1
  }, {merge: true});

});

Python (preview)

@on_document_updated(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:
  # Get the current and previous document values.
  new_value = event.data.after
  prev_value = event.data.before

  # We'll only update if the name has changed.
  # This is crucial to prevent infinite loops.
  if new_value.get("name") == prev_value.get("name"):
      return

  # Retrieve the current count of name changes
  count = new_value.to_dict().get("name_change_count", 0)

  # Update the count
  new_value.reference.update({"name_change_count": count + 1})

उपयोगकर्ता की पुष्टि करने की जानकारी ऐक्सेस करना

अगर नीचे दिए गए इवेंट टाइप में से किसी एक का इस्तेमाल किया जाता है, तो ऐक्सेस किया जा सकता है इवेंट को ट्रिगर करने वाले मुख्य खाते के बारे में उपयोगकर्ता की पुष्टि करने से जुड़ी जानकारी. यह जानकारी, बेस इवेंट में मिली जानकारी से अलग होती है.

Node.js

  • onDocumentCreatedWithAuthContext
  • onDocumentWrittenWithAuthContext
  • onDocumentDeletedWithAuthContext
  • onDocumentUpdatedWithAuthContext

Python (preview)

  • on_document_created_with_auth_context
  • on_document_updated_with_auth_context
  • on_document_deleted_with_auth_context
  • on_document_written_with_auth_context

पुष्टि करने के लिए उपलब्ध डेटा के बारे में जानने के लिए, देखें पुष्टि का कॉन्टेक्स्ट. नीचे दिए गए उदाहरण में, पुष्टि करने की जानकारी वापस पाने का तरीका बताया गया है:

Node.js

import { onDocumentWrittenWithAuthContext } from "firebase-functions/v2/firestore"

exports.syncUser = onDocumentWrittenWithAuthContext("users/{userId}", (event) => {
    const snapshot = event.data.after;
    if (!snapshot) {
        console.log("No data associated with the event");
        return;
    }
    const data = snapshot.data();

    // retrieve auth context from event
    const { authType, authId } = event;

    let verified = false;
    if (authType === "system") {
      // system-generated users are automatically verified
      verified = true;
    } else if (authType === "unknown" || authType === "unauthenticated") {
      // admin users from a specific domain are verified
      if (authId.endsWith("@example.com")) {
        verified = true;
      }
    }

    return data.after.ref.set({
        created_by: authId,
        verified,
    }, {merge: true}); 
}); 

Python (preview)

@on_document_updated_with_auth_context(document="users/{userId}")
def myfunction(event: Event[Change[DocumentSnapshot]]) -> None:

  # Get the current and previous document values.
  new_value = event.data.after
  prev_value = event.data.before

  # Get the auth context from the event
  user_auth_type = event.auth_type
  user_auth_id = event.auth_id

ट्रिगर इवेंट से बाहर का डेटा

Cloud Functions, भरोसेमंद जगह पर काम करता है. वे हैं को आपके प्रोजेक्ट पर सेवा खाते के तौर पर अनुमति मिली हुई है और आप टेक्स्ट पढ़ सकते हैं और Firebase एडमिन SDK का इस्तेमाल करके लिखता है:

Node.js

const { initializeApp } = require('firebase-admin/app');
const { getFirestore, Timestamp, FieldValue } = require('firebase-admin/firestore');

initializeApp();
const db = getFirestore();

exports.writetofirestore = onDocumentWritten("some/doc", (event) => {
    db.doc('some/otherdoc').set({ ... });
  });

  exports.writetofirestore = onDocumentWritten('users/{userId}', (event) => {
    db.doc('some/otherdoc').set({
      // Update otherdoc
    });
  });

Python (preview)

from firebase_admin import firestore, initialize_app
import google.cloud.firestore

initialize_app()

@on_document_written(document="some/doc")
def myfunction(event: Event[Change[DocumentSnapshot | None]]) -> None:
  firestore_client: google.cloud.firestore.Client = firestore.client()
  firestore_client.document("another/doc").set({
      # ...
  })

सीमाएं

Cloud Functions के लिए, Cloud Firestore ट्रिगर की इन सीमाओं का ध्यान रखें:

  • Cloud Functions (1st gen) के लिए, मौजूदा "(डिफ़ॉल्ट)" का होना ज़रूरी है Firebase के नेटिव मोड में डेटाबेस. इस पर काम नहीं होता Cloud Firestore के नाम वाले डेटाबेस या डेटास्टोर मोड के साथ काम कर सकता है. कृपया Cloud Functions का इस्तेमाल करें (2nd gen) को ऐसे मामलों में इवेंट कॉन्फ़िगर करना होगा.
  • ऑर्डर करने की कोई गारंटी नहीं है. तेज़ी से होने वाले बदलावों से, फ़ंक्शन शुरू करने की सुविधा अचानक ऑर्डर हो गया.
  • इवेंट कम से कम एक बार डिलीवर किए जाते हैं. हालांकि, किसी एक इवेंट की वजह से कई फ़ंक्शन शुरू करना. इन चीज़ों पर निर्भर रहने से बचें एक बार काम करने वाला मैकेनिक्स, और idemutent फ़ंक्शन का इस्तेमाल करें.
  • Datastore मोड में Cloud Firestore इसके लिए Cloud Functions (2nd gen) ज़रूरी है. Cloud Functions (1st gen) यह नहीं करता है डेटास्टोर मोड का समर्थन करता है.
  • ट्रिगर एक ही डेटाबेस से जुड़ा होता है. आप ऐसा ट्रिगर नहीं बना सकते जो एक से ज़्यादा डेटाबेस से मेल खाता हो.
  • किसी डेटाबेस को मिटाने से, उस डेटाबेस के लिए कोई भी ट्रिगर अपने-आप नहीं मिटता. कॉन्टेंट बनाने ट्रिगर इवेंट डिलीवर करना बंद कर देता है लेकिन जब तक आप ट्रिगर हटा नहीं देते तब तक मौजूद रहता है.
  • अगर मेल खाने वाला इवेंट, अनुरोध की संख्या से ज़्यादा हो जाता है, तो ऐसा हो सकता है कि इवेंट, Cloud Functions (1st gen) को डिलीवर न किया गया हो.
    • प्लैटफ़ॉर्म लॉग में, अनुरोध की संख्या की वजह से इवेंट डिलीवर नहीं हो सके और प्रोजेक्ट के लॉग उपयोग में गिना जाता है.
    • आपको ये लॉग, लॉग एक्सप्लोरर में इस मैसेज के साथ मिल सकते हैं: "इवेंट को डिलीवर नहीं किया जा सकता" क्लाउड फ़ंक्शन, 1st gen के लिए तय सीमा से ज़्यादा हो गया है..." error पेज चुने जा सकते हैं गंभीरता. functionName फ़ील्ड में, फ़ंक्शन का नाम देखा जा सकता है. अगर आपने receiveTimestamp फ़ील्ड अभी से एक घंटे के अंदर ही है, तो आप यह अनुमान लगा सकते हैं कि किसी दस्तावेज़ को पढ़ने के बाद, इस स्नैपशॉट से पहले और बाद में एक स्नैपशॉट होना चाहिए.
    • ऐसी गड़बड़ियों से बचने के लिए:
      • Cloud Functions (2nd gen) पर माइग्रेट और अपग्रेड करना
      • दस्तावेज़ का साइज़ छोटा करें
      • जिन Cloud Functions को हटाना है उन्हें मिटाएं
    • शामिल न करने की सेटिंग का इस्तेमाल करके, जानकारी इकट्ठा करने की सुविधा बंद की जा सकती है लेकिन ध्यान रखें कि आपत्तिजनक इवेंट अब भी डिलीवर नहीं किए जाएंगे.