Reference documentation and code samples for the Cloud Firestore API class Google::Cloud::Firestore::Filter.
Represents the filter for structured query.
Inherits
- Object
Methods
#and
def where(filter) -> Filter
def where(field, operator, value) -> FilterJoins filter using AND operator.
@param filter [::Google::Cloud::Firestore::Filter]
def where(filter) -> Filterwhere via field_or_filter argument.
def where(field, operator, value) -> Filterwhere via positional arguments.
-
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
- less than:
-
value (Object) —
The value to compare the property to. Defaults to nil. Possible values are:
- Integer
- Float/BigDecimal
- String
- Boolean
- Array
- Date/Time
- StringIO
- Google::Cloud::Datastore::Key
- Google::Cloud::Datastore::Entity
- nil
- (Filter) — New Filter object.
Pass a Filter type object in argument
require "google/cloud/firestore" filter_1 = Google::Cloud::Firestore.Firestore.new(:population, :>=, 1000000) filter_2 = Google::Cloud::Firestore.Firestore.new("done", "=", "false") filter = filter_1.and(filter_2)
Pass filter conditions in the argument
require "google/cloud/firestore" filter_1 = Google::Cloud::Firestore.Firestore.new(:population, :>=, 1000000) filter = filter_1.and("done", "=", "false")
#initialize
def initialize(field, operator, value) -> Google::Cloud::Firestore::FilterCreate a Filter object.
-
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
- less than:
-
value (Object) —
The value to compare the property to. Defaults to nil. Possible values are:
- Integer
- Float/BigDecimal
- String
- Boolean
- Array
- Date/Time
- StringIO
- Google::Cloud::Datastore::Key
- Google::Cloud::Datastore::Entity
- nil
- (Google::Cloud::Firestore::Filter) — New filter for the given condition
require "google/cloud/firestore" firestore = Google::Cloud::Firestore.new # Create a Filter Google::Cloud::Firestore::Filter.new(:population, :>=, 1000000)
#or
def where(filter) -> Filter
def where(field, operator, value) -> FilterJoins filter using OR operator.
@param filter [::Google::Cloud::Firestore::Filter]
def where(filter) -> Filterwhere via field_or_filter argument.
def where(field, operator, value) -> Filterwhere via positional arguments.
-
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
- less than:
-
value (Object) —
The value to compare the property to. Defaults to nil. Possible values are:
- Integer
- Float/BigDecimal
- String
- Boolean
- Array
- Date/Time
- StringIO
- Google::Cloud::Datastore::Key
- Google::Cloud::Datastore::Entity
- nil
- (Filter) — New Filter object.
Pass a Filter type object in argument
require "google/cloud/firestore" filter_1 = Google::Cloud::Firestore.Firestore.new(:population, :>=, 1000000) filter_2 = Google::Cloud::Firestore.Firestore.new("done", "=", "false") filter = filter_1.or(filter_2)
Pass filter conditions in the argument
require "google/cloud/firestore" filter_1 = Google::Cloud::Firestore.Firestore.new(:population, :>=, 1000000) filter = filter_1.or("done", "=", "false")