Sha256: a9bf1165d2e97b0a53d9c41ccd83e87d40ede5ed9d0bd590e44d7dea64d23cbe

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

# frozen_string_literal: true
module Mongoload
  module MongoContextWithAutoInclude
    def documents_for_iteration
      results = super
      if results.is_a?(Mongo::Collection::View)
        require 'byebug'
        begin
          results.to_a
        rescue SystemStackError
          byebug
        end
        results = results.map { |doc| Mongoid::Factory.from_db(klass, doc, criteria.options[:fields]) }
      end
      results.tap do |documents|
        Mongoload::AutoIncludeContext.register_docs(documents.to_a)
      end
    end
  end
end

Mongoid::Contextual::Mongo.prepend Mongoload::MongoContextWithAutoInclude

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongoload-0.0.1 lib/mongoload/patches/mongoid_contextual_mongo_patch.rb