Class Origin::Options
In: lib/origin/options.rb
Parent: Smash

The options is a hash representation of options passed to MongoDB queries, such as skip, limit, and sorting criteria.

Methods

[]=   __deep_copy__   fields   limit   skip   sort   store   to_pipeline  

Public Instance methods

[]=(key, value)

Alias for store

Perform a deep copy of the options.

@example Perform a deep copy.

  options.__deep_copy__

@return [ Options ] The copied options.

@since 2.3.1

Convenience method for getting the field options.

@example Get the fields options.

  options.fields

@return [ Hash ] The fields options.

@since 1.0.0

Convenience method for getting the limit option.

@example Get the limit option.

  options.limit

@return [ Integer ] The limit option.

@since 1.0.0

Convenience method for getting the skip option.

@example Get the skip option.

  options.skip

@return [ Integer ] The skip option.

@since 1.0.0

Convenience method for getting the sort options.

@example Get the sort options.

  options.sort

@return [ Hash ] The sort options.

@since 1.0.0

Store the value in the options for the provided key. The options will handle all necessary serialization and localization in this step.

@example Store a value in the options.

  options.store(:key, "testing")

@param [ String, Symbol ] key The name of the attribute. @param [ Object ] value The value to add.

@return [ Object ] The stored object.

@since 1.0.0

Convert the options to aggregation pipeline friendly options.

@example Convert the options to a pipeline.

  options.to_pipeline

@return [ Array<Hash> ] The options in pipeline form.

@since 2.0.0

[Validate]