pub enum MongoLoweringError {
ElementOperator(MongoOperator),
ElementConjunction,
ElementDocument,
ElementRelation,
NegatedRelation,
RelationWidth(RelationWidthError),
RelationDepth(RelationDepthError),
}mongo only.Expand description
Why a MongoDB comparison could not be rendered.
Four of the six members are one thing an ELEMENT SCOPE cannot hold; the other two are the
addressing a RELATION needs and did not get, and they are the query layer’s own payloads rather
than this family’s — see RelationWidthError and RelationDepthError.
§Relation was a member here and is not one now
It said a relation predicate is a join and find has none, and it was true while this family
rendered into a find filter and nothing else. The lane renders an AGGREGATION now — every lane,
flat query included — so $lookup has a position, and the blanket refusal became the rendering
in relation. What is left of it is the two shapes $lookup genuinely has no
spelling for, each named below.
§It is the family’s FIRST refusal, and the crossing is why there were none before
Every other failure a MongoDB comparison can have happens at the CROSSING — an operand that will
not convert, an operator no width can answer — and by the time a comparison exists it holds
storage values that rendering cannot reject. That is what let
Backend::Error for Mongo say
Infallible, and its own note said the day a kind could refuse it
would be named.
$elemMatch is that day, and the reason it could not be a crossing error is the reason
SqlLoweringError::JsonElementScope is not
one either: what refuses is the ELEMENT’s comparison, whose operator set the collection holding
it cannot read — it has a type parameter there and a [ComplexComparison] bound, and neither
says which keys the thing will write. The refusal is knowable exactly when it writes them.
§A refusal rather than a document the server would reject
The family’s standing rule is that a caller error must be REFUSED rather than resolved, and
ABSENT_FIELD implements it by writing a key the server has no reading for. That is second best
and says so: it is what a position with no return path can do. This position has one —
ComplexComparison::apply answers with a Result — so the
refusal is typed, names the operator where there is one to name, and never leaves the buffer.
Variants§
ElementOperator(MongoOperator)
An operator $elemMatch’s value form does not answer, named here by the row that carries the
measurement — MongoOperator::in_element_scope.
ElementConjunction
Two conjuncts inside one element scope that no single scope document can hold: the same operator twice, or a bare operator beside a field name.
The value form hosts no $and, so the fold MongoConjunction uses everywhere else has no
spelling here — and the two FORMS of $elemMatch do not mix, so a comparison writing at the
member AND at a field below it is the same refusal under a second cause. Both are the value
form running out, which is why they are one variant.
ElementDocument
A TOP-LEVEL operator — $expr or $nor — inside an element scope, which neither form hosts.
It is what a nested collection’s count or a nested set’s ne would need, and the server is
explicit about the first: $expr can only be applied to the top-level document.
ElementRelation
A RELATION predicate inside an element scope, which is a filter document and cannot hold a pipeline stage.
$lookup is a stage, so a relation contributes stages beside a $match rather than keys
inside one — and an $elemMatch has no pipeline around it to put them in. It is the element
scope’s fourth limit and the only one that is not about an operator.
Reachable from a collection of COMPOSITES whose element comparison carries a relation slot: the collection kind opens the scope, and what refuses is a comparison it cannot read.
NegatedRelation
A relation NESTED inside an all, whose lowering negates the predicate it is given.
all is no child fails — a $lookup whose own pipeline matches the children the predicate
EXCLUDES, under $nor, required to come back empty. $nor takes filter DOCUMENTS, so a
predicate that is itself a join has nothing to be negated as: its stages would have to run
inside a query operator that holds none.
Its three neighbours compose without this. any and none pass their predicate through
UNNEGATED — the negation is on the emptiness test outside the join — so a relation inside
either nests, and count asks nothing of the children at all.
RelationWidth(RelationWidthError)
A relation whose target — or whose parent — is addressed by SEVERAL columns; the payload carries which row and how many.
$lookup matches ONE localField against ONE foreignField, which is the same one-to-one
join the SQL family’s semi-join is. It bites twice as hard here: a document’s own id is the
_id key, and field_key maps a SINGLE-column address onto it, so a row addressed by
several has no _id for either side of the join to name.
Raised BEFORE either kind writes a stage, so it is a property of the RELATION rather than of the predicate inside it — the same relation cannot answer one filter and refuse another.
RelationDepth(RelationDepthError)
A relation nested deeper than its target’s join fields were minted for; the payload carries which row, how deep, and how many.
Reusing a name is the alternative, and here it is silent in a way of its own: a $lookup’s
as is a FIELD of the document it is joining onto, so a repeated one is written twice and the
second stage overwrites the first. The predicate that reads it then tests a set the filter
never asked about, and the pipeline runs.
Trait Implementations§
Source§impl Clone for MongoLoweringError
impl Clone for MongoLoweringError
impl Copy for MongoLoweringError
Source§impl Debug for MongoLoweringError
impl Debug for MongoLoweringError
Source§impl Display for MongoLoweringError
impl Display for MongoLoweringError
impl Eq for MongoLoweringError
Source§impl Error for MongoLoweringError
impl Error for MongoLoweringError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<MongoLoweringError> for MongoWriteError
impl From<MongoLoweringError> for MongoWriteError
Source§fn from(error: MongoLoweringError) -> Self
fn from(error: MongoLoweringError) -> Self
Source§impl From<MongoLoweringError> for MongoQueryError
impl From<MongoLoweringError> for MongoQueryError
Source§fn from(error: MongoLoweringError) -> Self
fn from(error: MongoLoweringError) -> Self
Source§impl PartialEq for MongoLoweringError
impl PartialEq for MongoLoweringError
impl StructuralPartialEq for MongoLoweringError
Auto Trait Implementations§
impl Freeze for MongoLoweringError
impl RefUnwindSafe for MongoLoweringError
impl Send for MongoLoweringError
impl Sync for MongoLoweringError
impl Unpin for MongoLoweringError
impl UnsafeUnpin for MongoLoweringError
impl UnwindSafe for MongoLoweringError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.impl<T> Fruit for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.