Special values that may be used when specifying the bounds of a window.
Special values that may be used when specifying the bounds of a window.
4.3
Requires MongoDB 5.0 or greater.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed documents window.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed documents window.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed documents window.
Requires MongoDB 5.0 or greater.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
Creates a documents window whose bounds are determined by a number of documents before and after the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed documents window.
Creates a window from Bson
in situations when there is no builder method that better satisfies your needs.
Creates a window from Bson
in situations when there is no builder method that better satisfies your needs.
This method cannot be used to validate the syntax.
Example
The following code creates two functionally identical windows, though they may not be equal.
val pastWeek1: Window = Windows.timeRange(-1, MongoTimeUnit.WEEK, Windows.Bound.CURRENT) val pastWeek2: Window = Windows.of( Document("range" -> BsonArray(-1, "current"), "unit" -> BsonString("week")))
A Bson
representing the required window.
The constructed window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around the value of the sortBy field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
A value based on which the lower bound of the window is calculated.
A time unit in which lower
is specified.
A value based on which the upper bound of the window is calculated.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
A time unit in which upper
is specified.
The constructed range window.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
Creates a dynamically-sized range window whose bounds are determined by a range of possible values around
the BSON Date
value of the sortBy
field in the current document.
A value based on which the lower bound of the window is calculated.
A value based on which the upper bound of the window is calculated.
A time unit in which lower
and upper
are specified.
The constructed range window.
(Since version ) see corresponding Javadoc for more information.
Builders for windows used when expressing windowed computations. There are two types of windows: documents and range.
Bounded and half-bounded windows require sorting. Window bounds are inclusive and the lower bound must always be less than or equal to the upper bound. The following type-specific rules are applied to windows:
sortBy
field must be of either a numeric BSON type (see the$isNumber
aggregation pipeline stage) or the BSONDate
type if time bounds are used;com.mongodb.client.model.Windows.Bound
, then the bound is calculated by adding the value to the value of thesortBy
field in the current document;sortBy
field;$dateAdd
/$dateSubtract
aggregation pipeline stage specification.4.3
Requires MongoDB 5.0 or greater.
$dateSubtract aggregation pipeline stage
$dateAdd aggregation pipeline stage
BSON Date type
$isNumber aggregation pipeline stage
WindowedComputation