Reference documentation and code samples for the Firestore in Datastore mode API class Google::Cloud::Datastore::Dataset::LookupResults.
LookupResults is a special case Array with additional values.
A LookupResults object is returned from #find_all and
contains the entities as well as the Keys that were deferred from
the results and the Entities that were missing in the dataset.
Please be cautious when treating the LookupResults as an Array.
Many common Array methods will return a new Array instance.
Retrieves all lookup results by repeatedly loading #next until
#next? returns false. Calls the given block once for each
result, which is passed as the parameter.
An Enumerator is returned if no block is given.
This method may make several API calls until all lookup results are
retrieved. Be sure to use as narrow a search criteria as possible.
Please use with caution.
Parameter
request_limit (Integer) (defaults to: nil) — The upper limit of API requests to
make to load all lookup results. Default is no limit.
Yields
(result) — The block for accessing each lookup result.
[[["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::Dataset::LookupResults (v2.13.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.13.0 (latest)](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.12.0](/ruby/docs/reference/google-cloud-datastore/2.12.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.11.0](/ruby/docs/reference/google-cloud-datastore/2.11.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.10.0](/ruby/docs/reference/google-cloud-datastore/2.10.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.9.0](/ruby/docs/reference/google-cloud-datastore/2.9.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.8.0](/ruby/docs/reference/google-cloud-datastore/2.8.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.7.1](/ruby/docs/reference/google-cloud-datastore/2.7.1/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.6.0](/ruby/docs/reference/google-cloud-datastore/2.6.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.5.0](/ruby/docs/reference/google-cloud-datastore/2.5.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.4.0](/ruby/docs/reference/google-cloud-datastore/2.4.0/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.3.1](/ruby/docs/reference/google-cloud-datastore/2.3.1/Google-Cloud-Datastore-Dataset-LookupResults)\n- [2.2.4](/ruby/docs/reference/google-cloud-datastore/2.2.4/Google-Cloud-Datastore-Dataset-LookupResults) \nReference documentation and code samples for the Firestore in Datastore mode API class Google::Cloud::Datastore::Dataset::LookupResults.\n\n[LookupResults](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults \"Google::Cloud::Datastore::Dataset::LookupResults (class)\") is a special case Array with additional values.\nA [LookupResults](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults \"Google::Cloud::Datastore::Dataset::LookupResults (class)\") object is returned from [#find_all](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset#Google__Cloud__Datastore__Dataset_find_all_instance_ \"Google::Cloud::Datastore::Dataset#find_all (method)\") and\ncontains the entities as well as the Keys that were deferred from\nthe results and the Entities that were missing in the dataset.\n\n\n\u003cbr /\u003e\n\nPlease be cautious when treating the [LookupResults](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults \"Google::Cloud::Datastore::Dataset::LookupResults (class)\") as an Array.\nMany common Array methods will return a new Array instance. \n\nInherits\n--------\n\n- Array\n\nExamples\n--------\n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntasks = datastore.find_all task_key1, task_key2, task_key3\ntasks.size #=\u003e 3\ntasks.deferred #=\u003e []\ntasks.missing #=\u003e []\n```\n\nCaution, many Array methods will return a new Array instance: \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntasks = datastore.find_all task_key1, task_key2, task_key3\ntasks.size #=\u003e 3\ntasks.deferred #=\u003e []\ntasks.missing #=\u003e []\ndescriptions = tasks.map { |t| t[\"description\"] }\ndescriptions.size #=\u003e 3\ndescriptions.deferred #=\u003e raise NoMethodError\ndescriptions.missing #=\u003e raise NoMethodError\n```\n\nMethods\n-------\n\n### #all\n\n def all(request_limit: nil, &block) { |result| ... } -\u003e Enumerator\n\nRetrieves all lookup results by repeatedly loading [#next](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults#Google__Cloud__Datastore__Dataset__LookupResults_next_instance_ \"Google::Cloud::Datastore::Dataset::LookupResults#next (method)\") until\n[#next?](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset-LookupResults#Google__Cloud__Datastore__Dataset__LookupResults_next__instance_ \"Google::Cloud::Datastore::Dataset::LookupResults#next? (method)\") returns `false`. Calls the given block once for each\nresult, which is passed as the parameter.\n\n\nAn Enumerator is returned if no block is given.\n\n\u003cbr /\u003e\n\nThis method may make several API calls until all lookup results are\nretrieved. Be sure to use as narrow a search criteria as possible.\nPlease use with caution. \n**Parameter**\n\n- **request_limit** (Integer) *(defaults to: nil)* --- The upper limit of API requests to make to load all lookup results. Default is no limit. \n**Yields**\n\n- (result) --- The block for accessing each lookup result. \n**Yield Parameter**\n\n- **result** ([Entity](./Google-Cloud-Datastore-Entity)) --- The lookup result object. \n**Returns**\n\n- (Enumerator)\n**Examples**\n\nIterating each result by passing a block: \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntask_key1 = datastore.key \"Task\", \"sampleTask1\"\ntask_key2 = datastore.key \"Task\", \"sampleTask2\"\ntasks = datastore.find_all task_key1, task_key2\ntasks.all do |t|\n puts \"Task #{t.key.id} (#cursor)\"\nend\n```\n\nUsing the enumerator by not passing a block: \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntask_key1 = datastore.key \"Task\", \"sampleTask1\"\ntask_key2 = datastore.key \"Task\", \"sampleTask2\"\ntasks = datastore.find_all task_key1, task_key2\nall_keys = tasks.all.map(&:key)\n```\n\nLimit the number of API calls made: \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntask_key1 = datastore.key \"Task\", \"sampleTask1\"\ntask_key2 = datastore.key \"Task\", \"sampleTask2\"\ntasks = datastore.find_all task_key1, task_key2\ntasks.all(request_limit: 10) do |t|\n puts \"Task #{t.key.id} (#cursor)\"\nend\n```\n\n### #deferred\n\n def deferred() -\u003e Array\u003cGoogle::Cloud::Datastore::Key\u003e\n\nKeys that were not looked up due to resource constraints. \n**Returns**\n\n- (Array\\\u003c[Google::Cloud::Datastore::Key](./Google-Cloud-Datastore-Key)\\\u003e)\n\n### #deferred=\n\n def deferred=(value) -\u003e Array\u003cGoogle::Cloud::Datastore::Key\u003e\n\nKeys that were not looked up due to resource constraints. \n**Parameter**\n\n- **value** (Array\\\u003c[Google::Cloud::Datastore::Key](./Google-Cloud-Datastore-Key)\\\u003e) \n**Returns**\n\n- (Array\\\u003c[Google::Cloud::Datastore::Key](./Google-Cloud-Datastore-Key)\\\u003e)\n\n### #missing\n\n def missing() -\u003e Array\u003cGoogle::Cloud::Datastore::Entity\u003e\n\nEntities not found, with only the key populated. \n**Returns**\n\n- (Array\\\u003c[Google::Cloud::Datastore::Entity](./Google-Cloud-Datastore-Entity)\\\u003e)\n\n### #missing=\n\n def missing=(value) -\u003e Array\u003cGoogle::Cloud::Datastore::Entity\u003e\n\nEntities not found, with only the key populated. \n**Parameter**\n\n- **value** (Array\\\u003c[Google::Cloud::Datastore::Entity](./Google-Cloud-Datastore-Entity)\\\u003e) \n**Returns**\n\n- (Array\\\u003c[Google::Cloud::Datastore::Entity](./Google-Cloud-Datastore-Entity)\\\u003e)\n\n### #next\n\n def next() -\u003e LookupResults\n\nRetrieve the next page of results. \n**Returns**\n\n- ([LookupResults](./Google-Cloud-Datastore-Dataset-LookupResults))\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntask_key1 = datastore.key \"Task\", \"sampleTask1\"\ntask_key2 = datastore.key \"Task\", \"sampleTask2\"\ntasks = datastore.find_all task_key1, task_key2\nif tasks.next?\n next_tasks = tasks.next\nend\n```\n\n### #next?\n\n def next?() -\u003e Boolean\n\nWhether there are more results available. \n**Returns**\n\n- (Boolean)\n**Example** \n\n```ruby\nrequire \"google/cloud/datastore\"\n\ndatastore = Google::Cloud::Datastore.new\n\ntask_key1 = datastore.key \"Task\", \"sampleTask1\"\ntask_key2 = datastore.key \"Task\", \"sampleTask2\"\ntasks = datastore.find_all task_key1, task_key2\nif tasks.next?\n next_tasks = tasks.next\nend\n```\n\n### #read_time\n\n def read_time() -\u003e Time, nil\n\nTime at which the entities are being read. This would not be\nolder than 270 seconds.\n\n\n\u003cbr /\u003e\n\nThis is a copy of the input parameter supplied to the [#find_all](/ruby/docs/reference/google-cloud-datastore/latest/Google-Cloud-Datastore-Dataset#Google__Cloud__Datastore__Dataset_find_all_instance_ \"Google::Cloud::Datastore::Dataset#find_all (method)\") function. \n**Returns**\n\n- (Time, nil)\n\n### #response_read_time\n\n def response_read_time() -\u003e Google::Protobuf::Timestamp\n\nThe time at which these entities were read or found missing. \n**Returns**\n\n- (Google::Protobuf::Timestamp)"]]