Method: Contentstack::Query#not_exists?

Defined in:
lib/contentstack/query.rb

#not_exists?(field_uid) ⇒ Contentstack::Query

Add a constraint that requires, a specified key does not exists in response. Example:

@query = @stack.content_type('product').query
@query.not_exists?('product_image') # only fetch products which do not have a `product_image`

Parameters:

  • field_uid (String)

    The key to be constrained.

Returns:


117
118
119
120
# File 'lib/contentstack/query.rb', line 117

def not_exists?(field_uid)
  add_query_hash({:"#{field_uid}" => {"$exists" => false}})
  self
end