mongodbfirebasegoogle-cloud-platformgoogle-cloud-firestore

The query limitation with max 30 filter parameters still exists in GCP Firestore Enterprise with MongoDB compatibility?


Firestore has query limitation with max 30 filter parameters in a single query. Recently, Google has announced that, Firestore Enterprise has MongoDB compatibility. Now, if we use MongoDB query in Firestore, will the filter parameter limitation be imposed on that query?


Solution

  • Seems, the filter query limitation is gone with the Firestore Enterprise edition MongoDB compatible.

    I created a Firestore Enterprise edition database using a billing account in Google Cloud Platform.

    I created a sample collection employees inside that database and populate the collection with some test documents.

    db.employees.find({
      name: { $in: ["name1", "name2", "name3", "name4", "name5", "name6", "name7", "name8", "name9", "name10", "name11", "name12", "name13", "name14", "name15", "name16", "name17"]},
      tags: { $nin: ["tag1", "tag2", "tag3", "tag4"]},
      age: { $gt: 20, $lt: 60},
      distance: { $gt: 2, $lt: 20}
    });
    

    This query contains 17 * 4 * 2 * 2 = 272 filter parameters.
    17 filter parameters passed for name.

    4 filter parameters passed for tags.

    2 filter parameters passed for age.

    2 filter parameters passed for distance.

    In standard edition, we would have used max 30 filter query parameters in combination. But with the new Enterprise edition, the filter query limitation is gone.