def get_entities(ids, options={})
      ids.each do |id|
        begin
          BSON::ObjectId.from_string(id)
        rescue BSON::ObjectId::Invalid
          raise NotFound.new(id) if options.fetch(:raise_exception, true)
          nil
        end
      end

      entities.where(:id => ids).map do |attrs|
        begin
          entity_type = EntityStore::Config.load_type(attrs[:_type])

          # Check if there is a snapshot key in use
          if entity_type.respond_to? :entity_store_snapshot_key
            active_key = entity_type.entity_store_snapshot_key

            # Discard the snapshot if the keys don't match
            unless active_key == attrs[:snapshot_key]
              attrs.delete(:snapshot)
            end
          end

          if attrs[:snapshot]
            if self.class.native_json_hash
              hash = attrs[:snapshot].to_h
            else
              hash = PigeonHole.parse(attrs[:snapshot])
            end

            entity = entity_type.new(hash)
          else
            entity = entity_type.new({'id' => attrs[:id].to_s })
          end
        rescue => e
          log_error "Error loading type #{attrs[:_type]}", e
          raise
        end

        entity
      end

    end
def get_entities(ids, options={})
      ids.each do |id|
        begin
          BSON::ObjectId.from_string(id)
        rescue BSON::ObjectId::Invalid
          raise NotFound.new(id) if options.fetch(:raise_exception, true)
          nil
        end
      end

      entities.where(:id => ids).map do |attrs|
        begin
          entity_type = EntityStore::Config.load_type(attrs[:_type])

          # Check if there is a snapshot key in use
          if entity_type.respond_to? :entity_store_snapshot_key
            active_key = entity_type.entity_store_snapshot_key

            # Discard the snapshot if the keys don't match
            unless active_key == attrs[:snapshot_key]
              attrs.delete(:snapshot)
            end
          end

          if attrs[:snapshot]
            if self.class.native_json_hash
              hash = attrs[:snapshot].to_h
            else
              hash = PigeonHole.parse(attrs[:snapshot])
            end

            entity = entity_type.new(hash)
          else
            entity = entity_type.new({'id' => attrs[:id].to_s })
          end
        rescue => e
          log_error "Error loading type #{attrs[:_type]}", e
          raise
        end

        entity
      end

    end
Public: loads the entity from the store, including any available snapshots
 then loads the events to complete the state

 ids           - Array of Strings representation of BSON::ObjectId
 options       - Hash of options (default: {})
                 :raise_exception - Boolean (default: true)

 Returns an array of entities