Class: MongoQL::Stage::Unwind
- Inherits:
-
MongoQL::Stage
- Object
- MongoQL::Stage
- MongoQL::Stage::Unwind
- Defined in:
- lib/mongo_ql/stage/unwind.rb
Instance Attribute Summary collapse
-
#allow_null ⇒ Object
Returns the value of attribute allow_null.
-
#ctx ⇒ Object
Returns the value of attribute ctx.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(ctx, path, allow_null: false) ⇒ Unwind
constructor
A new instance of Unwind.
- #to_ast ⇒ Object
Constructor Details
#initialize(ctx, path, allow_null: false) ⇒ Unwind
Returns a new instance of Unwind.
7 8 9 10 11 |
# File 'lib/mongo_ql/stage/unwind.rb', line 7 def initialize(ctx, path, allow_null: false) @ctx = ctx @path = to_expression(path) @allow_null = allow_null end |
Instance Attribute Details
#allow_null ⇒ Object
Returns the value of attribute allow_null.
5 6 7 |
# File 'lib/mongo_ql/stage/unwind.rb', line 5 def allow_null @allow_null end |
#ctx ⇒ Object
Returns the value of attribute ctx.
5 6 7 |
# File 'lib/mongo_ql/stage/unwind.rb', line 5 def ctx @ctx end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/mongo_ql/stage/unwind.rb', line 5 def path @path end |
Instance Method Details
#to_ast ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/mongo_ql/stage/unwind.rb', line 13 def to_ast ast = { "$unwind" => { "path" => path, "preserveNullAndEmptyArrays" => allow_null } } MongoQL::Utils.deep_transform_values(ast, &MongoQL::EXPRESSION_TO_AST_MAPPER) end |