Method: Contentstack::Query#and
- Defined in:
- lib/contentstack/query.rb
#and(queries) ⇒ Contentstack::Query
Combines all the queries together using AND 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.regex('description', '.*Electronics.*')
query_array = [@query1, @query2]
@query = @stack.content_type('category').query
@query.and(query_array)
140 141 142 143 |
# File 'lib/contentstack/query.rb', line 140 def and(queries) add_query_hash({"$and" => concat_queries(queries)}) self end |