1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! What a caller may say about how a package is RUN: [`MongoOptions`].
//!
//! # One type, and it holds one thing
//!
//! The lane's only policy is the READ CONCERN, and the policy is derived rather than configured —
//! see [`MongoOptions::concern`]. So this type exists to OVERRIDE a derivation, which is why its
//! single slot is an [`Option`] and why its default holds nothing: a caller who says nothing gets
//! the policy, and a caller who says something gets exactly that, on every call the value is passed
//! to.
//!
//! It is a type rather than a parameter because the derivation will grow — a `$lookup`'s ceiling, a
//! batch size, a comment for the profiler are all fields the lane will want — and a signature that
//! took each of them as an argument would break at every one. The house options shape is what makes
//! adding a field additive.
use ;
/// The read concern a pipeline spanning MORE THAN ONE collection runs under, unless a caller says
/// otherwise.
///
/// **`snapshot`**, and the reason is what a multi-collection pipeline IS: a `$lookup` reads the
/// looked-into collection at a point the server chooses, so without a snapshot the parent documents
/// and the joined ones can come from two different states of the database — a child that was
/// deleted after its parent was read, a parent whose join returns a row it no longer points at.
/// Neither is an error; both are an answer no consistent database ever held.
///
/// A LEVEL rather than a whole [`ReadConcern`], because the level is the part that is a constant:
/// `ReadConcern` is `#[non_exhaustive]` and its constructors are not `const`, so a `const` of the
/// level is as much of this decision as the type system will hold — and it is the whole decision.
///
/// # It needs MongoDB 5.0, which is this lane's floor
///
/// `snapshot` outside a transaction is a 5.0 feature. Below that the server refuses the command
/// rather than answering inconsistently, which is the failure mode to prefer — but it IS a refusal,
/// so the floor is documented here and in [`lane`](super::lane) rather than discovered by a
/// deployment.
pub const DEFAULT_SPANNING_CONCERN: ReadConcernLevel = Snapshot;
/// How a package is run: what a caller wants said about the read, and nothing about what to read.
///
/// # The empty value is the ordinary one
///
/// [`new`](Self::new) holds no override, so the lane derives the concern from the package — which
/// is the zero-glue path. Everything here is for the call that has a reason to differ.