Method: Contentstack::Query#or

Defined in:
lib/contentstack/query.rb

#or(queries) ⇒ Contentstack::Query

Combines all the queries together using OR operator.

Each query should be an instance of the Contentstack::Query class, and belong to the same content_type Example:

@query1 = @stack.content_type('category').query
@query1.where('title', 'Electronics')

@query2 = @stack.content_type('category').query
@query2.where('title', 'Apparel')

query_array = [@query1, @query2]

@query = @stack.content_type('category').query
@query.or(query_array)

Parameters:

  • queries (Array)

    Array of instances of the Query class

Returns:



163
164
165
166
# File 'lib/contentstack/query.rb', line 163

def or(queries)
  add_query_hash({"$or" => concat_queries(queries)})
  self
end