project_id(String) — Identifier for a Firestore project. If not
present, the default project for the credentials is used.
credentials(String, Hash, Google::Auth::Credentials) — The path to
the keyfile as a String, the contents of the keyfile as a Hash, or a
Google::Auth::Credentials object. (SeeFirestore::Credentials)
[[["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 2025-09-04 UTC."],[],[],null,["# Cloud Firestore API - Module Google::Cloud (v3.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.1.0 (latest)](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud)\n- [3.0.0](/ruby/docs/reference/google-cloud-firestore/3.0.0/Google-Cloud)\n- [2.16.1](/ruby/docs/reference/google-cloud-firestore/2.16.1/Google-Cloud)\n- [2.15.1](/ruby/docs/reference/google-cloud-firestore/2.15.1/Google-Cloud)\n- [2.14.0](/ruby/docs/reference/google-cloud-firestore/2.14.0/Google-Cloud)\n- [2.13.1](/ruby/docs/reference/google-cloud-firestore/2.13.1/Google-Cloud)\n- [2.12.0](/ruby/docs/reference/google-cloud-firestore/2.12.0/Google-Cloud)\n- [2.11.0](/ruby/docs/reference/google-cloud-firestore/2.11.0/Google-Cloud)\n- [2.10.1](/ruby/docs/reference/google-cloud-firestore/2.10.1/Google-Cloud)\n- [2.9.1](/ruby/docs/reference/google-cloud-firestore/2.9.1/Google-Cloud)\n- [2.8.0](/ruby/docs/reference/google-cloud-firestore/2.8.0/Google-Cloud)\n- [2.7.2](/ruby/docs/reference/google-cloud-firestore/2.7.2/Google-Cloud)\n- [2.6.6](/ruby/docs/reference/google-cloud-firestore/2.6.6/Google-Cloud) \nReference documentation and code samples for the Cloud Firestore API module Google::Cloud.\n\nMethods\n-------\n\n### .firestore\n\n def self.firestore(project_id = nil, credentials = nil, scope: nil, timeout: nil, database_id: nil, transport: nil) -\u003e Google::Cloud::Firestore::Client\n\nCreates a new object for connecting to the Firestore service.\nEach call creates a new connection.\n\n\n\u003cbr /\u003e\n\nFor more information on connecting to Google Cloud see the\n[Authentication Guide](./AUTHENTICATION \"Authentication Guide\"). \n**Parameters**\n\n- **project_id** (String) --- Identifier for a Firestore project. If not present, the default project for the credentials is used.\n- **credentials** (String, Hash, Google::Auth::Credentials) --- The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object. (See [Firestore::Credentials](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-Credentials \"Google::Cloud::Firestore::Credentials (class)\"))\n- **scope** (String, Array\\\u003cString\\\u003e) *(defaults to: nil)* ---\n\n The OAuth 2.0 scopes controlling the\n set of resources and operations that the connection can access. See\n [Using OAuth 2.0 to Access Google\n APIs](https://developers.google.com/identity/protocols/OAuth2).\n\n The default scope is:\n - `https://www.googleapis.com/auth/datastore`\n- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional.\n- **database_id** (String) *(defaults to: nil)* --- Identifier for a Firestore database. If not present, the default database of the project is used.\n- **transport** (:grpc, :rest) *(defaults to: nil)* --- Which transport to use to communicate with the server. Defaults to `:grpc`. \n**Returns**\n\n- ([Google::Cloud::Firestore::Client](./Google-Cloud-Firestore-Client))\n**Example** \n\n```ruby\nrequire \"google/cloud\"\n\nfirestore = Google::Cloud.firestore\n```\n\n### #firestore\n\n def firestore(scope: nil, timeout: nil, database_id: nil, transport: nil) -\u003e Google::Cloud::Firestore::Client\n\nCreates a new object for connecting to the Firestore service.\nEach call creates a new connection.\n\n\n\u003cbr /\u003e\n\nFor more information on connecting to Google Cloud see the\n[Authentication Guide](./AUTHENTICATION \"Authentication Guide\"). \n**Parameters**\n\n- **scope** (String, Array\\\u003cString\\\u003e) *(defaults to: nil)* ---\n\n The OAuth 2.0 scopes controlling the\n set of resources and operations that the connection can access. See\n [Using OAuth 2.0 to Access Google\n APIs](https://developers.google.com/identity/protocols/OAuth2).\n\n The default scope is:\n - `https://www.googleapis.com/auth/datastore`\n- **timeout** (Integer) *(defaults to: nil)* --- Default timeout to use in requests. Optional.\n- **database_id** (String) *(defaults to: nil)* --- Identifier for a Firestore database. If not present, the default database of the project is used.\n- **transport** (:grpc, :rest) *(defaults to: nil)* --- Which transport to use to communicate with the server. Defaults to `:grpc`. \n**Returns**\n\n- ([Google::Cloud::Firestore::Client](./Google-Cloud-Firestore-Client))\n**Examples** \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\nfirestore = gcloud.firestore\n```\n\nThe default scope can be overridden with the `scope` option: \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\nplatform_scope = \"https://www.googleapis.com/auth/cloud-platform\"\nfirestore = gcloud.firestore scope: platform_scope\n```\n\nThe default database can be overridden with the `database_id` option: \n\n```ruby\nrequire \"google/cloud\"\n\ngcloud = Google::Cloud.new\ndatabase_id = \"my-todo-database\"\nfirestore = gcloud.firestore database_id: database_id\n```"]]