Pass Firestore::Filter to where via field_or_filter argument.
defwhere(field,operator,value)->Filter
Pass arguments to where via positional arguments.
Parameters
field (FieldPath, String, Symbol) — A field path to filter
results with.
If a FieldPath object is not provided then the field will be
treated as a dotted string, meaning the string represents individual
fields joined by ".". Fields containing ~, *, /, [, ], and
. cannot be in a dotted string, and should provided using a
FieldPath object instead.
operator (String, Symbol) —
The operation to compare the field
to. Acceptable values include:
less than: <, lt
less than or equal: <=, lte
greater than: >, gt
greater than or equal: >=, gte
equal: =, ==, eq, eql, is
not equal: !=
in: in
not in: not-in, not_in
array contains: array-contains, array_contains
value (Object) —
The value to compare the property to. Defaults to nil.
Possible values are:
field (FieldPath, String, Symbol) — A field path to filter
results with.
If a FieldPath object is not provided then the field will be
treated as a dotted string, meaning the string represents individual
fields joined by ".". Fields containing ~, *, /, [, ], and
. cannot be in a dotted string, and should provided using a
FieldPath object instead.
operator (String, Symbol) —
The operation to compare the field
to. Acceptable values include:
less than: <, lt
less than or equal: <=, lte
greater than: >, gt
greater than or equal: >=, gte
equal: =, ==, eq, eql, is
not equal: !=
in: in
not in: not-in, not_in
array contains: array-contains, array_contains
value (Object) —
The value to compare the property to. Defaults to nil.
Possible values are:
Pass Firestore::Filter to where via field_or_filter argument.
defwhere(field,operator,value)->Filter
Pass arguments to where via positional arguments.
Parameters
field (FieldPath, String, Symbol) — A field path to filter
results with.
If a FieldPath object is not provided then the field will be
treated as a dotted string, meaning the string represents individual
fields joined by ".". Fields containing ~, *, /, [, ], and
. cannot be in a dotted string, and should provided using a
FieldPath object instead.
operator (String, Symbol) —
The operation to compare the field
to. Acceptable values include:
less than: <, lt
less than or equal: <=, lte
greater than: >, gt
greater than or equal: >=, gte
equal: =, ==, eq, eql, is
not equal: !=
in: in
not in: not-in, not_in
array contains: array-contains, array_contains
value (Object) —
The value to compare the property to. Defaults to nil.
Possible values are:
[[["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-09 UTC."],[],[],null,["# Cloud Firestore API - Class Google::Cloud::Firestore::Filter (v3.1.0)\n\nVersion latestkeyboard_arrow_down\n\n- [3.1.0 (latest)](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-Filter)\n- [3.0.0](/ruby/docs/reference/google-cloud-firestore/3.0.0/Google-Cloud-Firestore-Filter)\n- [2.16.1](/ruby/docs/reference/google-cloud-firestore/2.16.1/Google-Cloud-Firestore-Filter)\n- [2.15.1](/ruby/docs/reference/google-cloud-firestore/2.15.1/Google-Cloud-Firestore-Filter)\n- [2.14.0](/ruby/docs/reference/google-cloud-firestore/2.14.0/Google-Cloud-Firestore-Filter)\n- [2.13.1](/ruby/docs/reference/google-cloud-firestore/2.13.1/Google-Cloud-Firestore-Filter)\n- [2.12.0](/ruby/docs/reference/google-cloud-firestore/2.12.0/Google-Cloud-Firestore-Filter)\n- [2.11.0](/ruby/docs/reference/google-cloud-firestore/2.11.0/Google-Cloud-Firestore-Filter)\n- [2.10.1](/ruby/docs/reference/google-cloud-firestore/2.10.1/Google-Cloud-Firestore-Filter)\n- [2.9.1](/ruby/docs/reference/google-cloud-firestore/2.9.1/Google-Cloud-Firestore-Filter)\n- [2.8.0](/ruby/docs/reference/google-cloud-firestore/2.8.0/Google-Cloud-Firestore-Filter)\n- [2.7.2](/ruby/docs/reference/google-cloud-firestore/2.7.2/Google-Cloud-Firestore-Filter)\n- [2.6.6](/ruby/docs/reference/google-cloud-firestore/2.6.6/Google-Cloud-Firestore-Filter) \nReference documentation and code samples for the Cloud Firestore API class Google::Cloud::Firestore::Filter.\n\nRepresents the filter for structured query. \n\nInherits\n--------\n\n- Object\n\nMethods\n-------\n\n### #and\n\n def where(filter) -\u003e Filter\n def where(field, operator, value) -\u003e Filter\n\nJoins filter using AND operator.\n\n\n\u003cbr /\u003e\n\n@param filter \\[::Google::Cloud::Firestore::Filter\\] \n**Overloads** \n\n def where(filter) -\u003e Filter\n\nPass Firestore::Filter to `where` via field_or_filter argument. \n\n def where(field, operator, value) -\u003e Filter\n\nPass arguments to `where` via positional arguments. \n**Parameters**\n\n- **field** ([FieldPath](./Google-Cloud-Firestore-FieldPath), String, Symbol) --- A field path to filter results with. If a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object is not provided then the field will be treated as a dotted string, meaning the string represents individual fields joined by \".\". Fields containing `~`, `*`, `/`, `[`, `]`, and `.` cannot be in a dotted string, and should provided using a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object instead.\n- **operator** (String, Symbol) ---\n\n The operation to compare the field\n to. Acceptable values include:\n - less than: `\u003c`, `lt`\n - less than or equal: `\u003c=`, `lte`\n - greater than: `\u003e`, `gt`\n - greater than or equal: `\u003e=`, `gte`\n - equal: `=`, `==`, `eq`, `eql`, `is`\n - not equal: `!=`\n - in: `in`\n - not in: `not-in`, `not_in`\n - array contains: `array-contains`, `array_contains`\n- **value** (Object) ---\n\n The value to compare the property to. Defaults to nil.\n Possible values are:\n - Integer\n - Float/BigDecimal\n - String\n - Boolean\n - Array\n - Date/Time\n - StringIO\n - Google::Cloud::Datastore::Key\n - Google::Cloud::Datastore::Entity\n- nil \n**Returns**\n\n- ([Filter](./Google-Cloud-Firestore-Filter)) --- New Filter object.\n**Examples**\n\nPass a Filter type object in argument \n\n```ruby\nrequire \"google/cloud/firestore\"\n\nfilter_1 = Google::Cloud::Firestore.Firestore.new(:population, :\u003e=, 1000000)\nfilter_2 = Google::Cloud::Firestore.Firestore.new(\"done\", \"=\", \"false\")\n\nfilter = filter_1.and(filter_2)\n```\n\nPass filter conditions in the argument \n\n```ruby\nrequire \"google/cloud/firestore\"\n\nfilter_1 = Google::Cloud::Firestore.Firestore.new(:population, :\u003e=, 1000000)\n\nfilter = filter_1.and(\"done\", \"=\", \"false\")\n```\n\n### #initialize\n\n def initialize(field, operator, value) -\u003e Google::Cloud::Firestore::Filter\n\nCreate a Filter object. \n**Parameters**\n\n- **field** ([FieldPath](./Google-Cloud-Firestore-FieldPath), String, Symbol) --- A field path to filter results with. If a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object is not provided then the field will be treated as a dotted string, meaning the string represents individual fields joined by \".\". Fields containing `~`, `*`, `/`, `[`, `]`, and `.` cannot be in a dotted string, and should provided using a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object instead.\n- **operator** (String, Symbol) ---\n\n The operation to compare the field\n to. Acceptable values include:\n - less than: `\u003c`, `lt`\n - less than or equal: `\u003c=`, `lte`\n - greater than: `\u003e`, `gt`\n - greater than or equal: `\u003e=`, `gte`\n - equal: `=`, `==`, `eq`, `eql`, `is`\n - not equal: `!=`\n - in: `in`\n - not in: `not-in`, `not_in`\n - array contains: `array-contains`, `array_contains`\n- **value** (Object) ---\n\n The value to compare the property to. Defaults to nil.\n Possible values are:\n - Integer\n - Float/BigDecimal\n - String\n - Boolean\n - Array\n - Date/Time\n - StringIO\n - Google::Cloud::Datastore::Key\n - Google::Cloud::Datastore::Entity\n- nil \n**Returns**\n\n- ([Google::Cloud::Firestore::Filter](./Google-Cloud-Firestore-Filter)) --- New filter for the given condition\n**Example** \n\n```ruby\nrequire \"google/cloud/firestore\"\n\nfirestore = Google::Cloud::Firestore.new\n\n# Create a Filter\nGoogle::Cloud::Firestore::Filter.new(:population, :\u003e=, 1000000)\n```\n\n### #or\n\n def where(filter) -\u003e Filter\n def where(field, operator, value) -\u003e Filter\n\nJoins filter using OR operator.\n\n\n\u003cbr /\u003e\n\n@param filter \\[::Google::Cloud::Firestore::Filter\\] \n**Overloads** \n\n def where(filter) -\u003e Filter\n\nPass Firestore::Filter to `where` via field_or_filter argument. \n\n def where(field, operator, value) -\u003e Filter\n\nPass arguments to `where` via positional arguments. \n**Parameters**\n\n- **field** ([FieldPath](./Google-Cloud-Firestore-FieldPath), String, Symbol) --- A field path to filter results with. If a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object is not provided then the field will be treated as a dotted string, meaning the string represents individual fields joined by \".\". Fields containing `~`, `*`, `/`, `[`, `]`, and `.` cannot be in a dotted string, and should provided using a [FieldPath](/ruby/docs/reference/google-cloud-firestore/latest/Google-Cloud-Firestore-FieldPath \"Google::Cloud::Firestore::FieldPath (class)\") object instead.\n- **operator** (String, Symbol) ---\n\n The operation to compare the field\n to. Acceptable values include:\n - less than: `\u003c`, `lt`\n - less than or equal: `\u003c=`, `lte`\n - greater than: `\u003e`, `gt`\n - greater than or equal: `\u003e=`, `gte`\n - equal: `=`, `==`, `eq`, `eql`, `is`\n - not equal: `!=`\n - in: `in`\n - not in: `not-in`, `not_in`\n - array contains: `array-contains`, `array_contains`\n- **value** (Object) ---\n\n The value to compare the property to. Defaults to nil.\n Possible values are:\n - Integer\n - Float/BigDecimal\n - String\n - Boolean\n - Array\n - Date/Time\n - StringIO\n - Google::Cloud::Datastore::Key\n - Google::Cloud::Datastore::Entity\n- nil \n**Returns**\n\n- ([Filter](./Google-Cloud-Firestore-Filter)) --- New Filter object.\n**Examples**\n\nPass a Filter type object in argument \n\n```ruby\nrequire \"google/cloud/firestore\"\n\nfilter_1 = Google::Cloud::Firestore.Firestore.new(:population, :\u003e=, 1000000)\nfilter_2 = Google::Cloud::Firestore.Firestore.new(\"done\", \"=\", \"false\")\n\nfilter = filter_1.or(filter_2)\n```\n\nPass filter conditions in the argument \n\n```ruby\nrequire \"google/cloud/firestore\"\n\nfilter_1 = Google::Cloud::Firestore.Firestore.new(:population, :\u003e=, 1000000)\n\nfilter = filter_1.or(\"done\", \"=\", \"false\")\n```"]]