mongodb/mongoid · error · Mongoid::Errors::DocumentNotFound
Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:
Error message
Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))
What it means
Error "Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))" thrown in mongodb/mongoid.
Source
Thrown at lib/mongoid/criteria.rb:582
private
# Are documents in the query missing, and are we configured to raise an
# error?
#
# @api private
#
# @example Check for missing documents.
# criteria.check_for_missing_documents!([], [ 1 ])
#
# @param [ Array<Document> ] result The result.
# @param [ Array<Object> ] ids The ids.
#
# @raise [ Errors::DocumentNotFound ] If none are found and raising an
# error.
def check_for_missing_documents!(result, ids)
return unless (result.size < ids.size) && Mongoid.raise_not_found_error
raise Errors::DocumentNotFound.new(klass, ids, ids - result.map(&:_id))
end
# Clone or dup the current +Criteria+. This will return a new criteria with
# the selector, options, klass, embedded options, etc intact.
#
# @api private
#
# @example Clone a criteria.
# criteria.clone
#
# @example Dup a criteria.
# criteria.dup
#
# @param [ Criteria ] other The criteria getting cloned.
#
# @return [ nil ] nil.
def initialize_copy(other)
@inclusions = other.inclusions.dupView on GitHub (pinned to 0da0e23d71)
When it happens
Trigger: Thrown at lib/mongoid/criteria.rb:582 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of mongodb/mongoid@0da0e23d71 (2026-08-23).
Data as JSON: /api/errors/b81135e3ab114e83.
Report an issue: GitHub.