[ Web Proxy ]
URL:
Viewing: https://cloud.google.com/firestore/mongodb-compatibility/pricing-examples [Back]  [Original]

Pricing examples  |  Google Cloud Skip to main content
Overview Solutions Products Pricing Resources Docs Support
Search:
Docs Support Console
Google Cloud [Google Cloud]
Stay organized with collections Save and categorize content based on your preferences.

Pricing examples

This page includes examples of how billing units are calculated in some of the most common scenarios. Note that each query might differ in data processed based on factors such as the query plan, the shape of the data, and the indexes available.

We recommend using the Query Explain feature to better understand the cost and performance of your specific queries.

Read operations

Most read operations entail either performing a point read of a specific document or scanning a range of data based on an identifier. Read operations consume read units. See the following examples.

Charges for full-text search queries are distinguished between the cost to perform a search on a text index and the cost to retrieve the documents. The cost to perform a search on a text index is determined by the complexity of the query and the amount of data scanned in the index to find the results. Factors influencing this cost include the number and nature of search terms (e.g. terms, phrases), whether relevance scoring is applied, and the number of index entries that need to be examined. The cost for retrieving relevant documents is based on the number and size of documents fetched after the search phase is complete.

The following table delineates the charges associated with executing full-text search queries for an ecommerce product catalog for a plant nursery. This example assumes a collection of 200,000 product listings in a collection, with each product listing document being 2KiB, and a corresponding text search index size of approximately 100MiB.

Query Code Example Estimated Read Units Consumed Per Query Estimated Costs (region: us-central1 in USD)
Search for a rare "dry water" stack flat tray product, resulting in the retrieval of 3 documents.
db.products.find(
  {$text: {$search: '"dry water" stack flat'}}
);

10 total read units

Based on 7 units for full-text search and 3 additional units for the returned documents.

$0.50 per million queries
Search for all indoor citrus trees, resulting in the retrieval of 36 documents.
db.products.find(
  {$text: {$search: '"indoor" "citrus" "tree"'}}
);

42 total read units

Based on 6 units for full-text search and 36 additional units for the returned documents.

$2.10 per million queries
Search for balcony planters where there are lots of product matches. Sort results by relevance, and limit to the top 50 search results.
db.products.find(
  {$text: {$search: 'balcony planter'}}
).sort({score: {$meta: "textScore"}}).limit(50);

75 total read units

Based on 25 units for full-text search and 50 additional units for the returned documents.

$3.75 per million queries

These examples illustrate how different query patterns impact costs:

Geospatial Queries

Charges for geospatial queries are determined by the complexity of the query and the specific conditions and sorting utilized, as well as the resources required to scan all the data in the relevant geospatial index.

The following table delineates the charges associated with executing geospatial queries for a maps application. This example assumes a collection of 1,000,000 documents representing points of interest, with each point of interest document being 1KiB, and a corresponding geospatial index size of approximately 60MiB.

Query Code Example Estimated Read Units Consumed Per Query Estimated Costs (region: us-central1 in USD)
Find all points of interest within a maximum of 10km, returning 10 matches.
db.pois.find(
  {location: {
    $near: {
      $geometry: <point>,
      $maxDistance: 10000
    }}})

16 total read units.

Based on 6 read units for geospatial query and 10 additional units for the returned documents.

$0.80 per million queries
Find all points of interests with a maximum distance of 100km, and return the top 10 closest points of interest out of 1,000 matches
db.pois.find(
  {location: {
    $near: {
      $geometry: <point>,
      $maxDistance: 100000
    }}}).limit(10)

19 total read units.

Based on 9 read units for geospatial query and 10 additional units for the returned documents.

$0.95 per million queries

These examples illustrate how different query patterns impact costs:

Point reads

Example billing for point reads:

Scanning

The following examples include scenarios that scan documents or index entries.

Scanning Documents

Scanning indexes

The scanning cost, in terms of bytes, is the same regardless of whether it is a document or index being scanned. However, index entries are often smaller in size. As a result, they can often provide a more cost effective way of scanning data.

Minimum document or index entry size

In certain situations it may not be necessary to read the contents of a document or index entry to satisfy a query. This includes simple count queries like counting the total number of documents in a collection. In these situations, a minimum cost of 32 bytes applies per item scanned.

Combination of scanning and point reads

Many queries perform a combination of scanning and point reads to satisfy an operation.

Query Explain

Query Explain helps you understand how the database executes your queries. The details provided can help you optimize your queries.

The following costs apply when using Query Explain:

Write operations

Write operations (creates, updates and deletes) are charged based on the size of the documents and indexes being created, modified, or deleted during the operation. Write operations consume write units. Write units are calculated in 1 KiB tranches.

Simple write operations, like update by document ID, only incur the cost of the writes. Write operations which require querying to satisfy the operation will additionally incur the read costs associated with the query.

See the following examples.

Creates

Updates

Deletes

Index builds

Index builds charge for the index entries created or modified during the build operation. These costs are incurred anytime an index definition is added or removed. The index entries are billed identically to writes incurring 1 write unit per 1KiB.

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-08-11 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-11 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page