[[["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-08-28 UTC."],[],[],null,["# Firestore in Datastore mode API - Class Google::Cloud::Datastore::Commit (v2.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.0 (latest)](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Commit)\n- [2.12.0](/ruby/docs/reference/google-cloud-datastore/2.12.0/Google-Cloud-Datastore-Commit)\n- [2.11.0](/ruby/docs/reference/google-cloud-datastore/2.11.0/Google-Cloud-Datastore-Commit)\n- [2.10.0](/ruby/docs/reference/google-cloud-datastore/2.10.0/Google-Cloud-Datastore-Commit)\n- [2.9.0](/ruby/docs/reference/google-cloud-datastore/2.9.0/Google-Cloud-Datastore-Commit)\n- [2.8.0](/ruby/docs/reference/google-cloud-datastore/2.8.0/Google-Cloud-Datastore-Commit)\n- [2.7.1](/ruby/docs/reference/google-cloud-datastore/2.7.1/Google-Cloud-Datastore-Commit)\n- [2.6.0](/ruby/docs/reference/google-cloud-datastore/2.6.0/Google-Cloud-Datastore-Commit)\n- [2.5.0](/ruby/docs/reference/google-cloud-datastore/2.5.0/Google-Cloud-Datastore-Commit)\n- [2.4.0](/ruby/docs/reference/google-cloud-datastore/2.4.0/Google-Cloud-Datastore-Commit)\n- [2.3.1](/ruby/docs/reference/google-cloud-datastore/2.3.1/Google-Cloud-Datastore-Commit)\n- [2.2.4](/ruby/docs/reference/google-cloud-datastore/2.2.4/Google-Cloud-Datastore-Commit) \nReference documentation and code samples for the Firestore in Datastore mode API class Google::Cloud::Datastore::Commit.\n\nCommit\n------\n\nObject yielded from `commit` methods to allow multiple changes to be\nmade in a single commit.\n\nSee [Dataset#commit](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset#Google__Cloud__Datastore__Dataset_commit_instance_ \"Google::Cloud::Datastore::Dataset#commit (method)\") and\n[Transaction#commit](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Transaction#Google__Cloud__Datastore__Transaction_commit_instance_ \"Google::Cloud::Datastore::Transaction#commit (method)\"). \n\nInherits\n--------\n\n- Object\n\nExample\n-------\n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.save task3, task4\n c.delete task1, task2\nend\n```\n\nMethods\n-------\n\n### #delete\n\n def delete(*entities_or_keys)\n\nRemove entities from the Datastore. \n**Parameter**\n\n- **entities_or_keys** ([Entity](./Google-Cloud-Datastore-Entity), [Key](./Google-Cloud-Datastore-Key)) --- One or more Entity or Key objects to remove.\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.delete task1, task2\nend\n```\n\n### #insert\n\n def insert(*entities)\n\nInserts entities to the Datastore. \n**Parameter**\n\n- **entities** ([Entity](./Google-Cloud-Datastore-Entity)) --- One or more Entity objects to insert.\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.insert task1, task2\nend\n```\n\n### #save\n\n def save(*entities)\n\n**Aliases**\n\n- [#upsert](./Google-Cloud-Datastore-Commit#Google__Cloud__Datastore__Commit_upsert_instance_) \nSaves entities to the Datastore. \n**Parameter**\n\n- **entities** ([Entity](./Google-Cloud-Datastore-Entity)) --- One or more Entity objects to save.\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.save task1, task2\nend\n```\n\n### #update\n\n def update(*entities)\n\nUpdates entities to the Datastore. \n**Parameter**\n\n- **entities** ([Entity](./Google-Cloud-Datastore-Entity)) --- One or more Entity objects to update.\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.update task1, task2\nend\n```\n\n### #upsert\n\n def upsert(*entities)\n\n**Alias Of** : [#save](./Google-Cloud-Datastore-Commit#Google__Cloud__Datastore__Commit_save_instance_) \nSaves entities to the Datastore. \n**Parameter**\n\n- **entities** ([Entity](./Google-Cloud-Datastore-Entity)) --- One or more Entity objects to save.\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ndatastore.commit do |c|\n c.save task1, task2\nend\n```"]]