Table of Contents

Method Shift

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.dll

Shift<TInput, TValue>(ISetWindowFieldsPartition<TInput>, Func<TInput, TValue>, int)

Returns the value from an expression applied to a document in a specified position relative to the current document.

public static TValue Shift<TInput, TValue>(this ISetWindowFieldsPartition<TInput> partition, Func<TInput, TValue> selector, int by)

Parameters

partition ISetWindowFieldsPartition<TInput>

The partition.

selector Func<TInput, TValue>

The selector that selects a value from the input document.

by int

The relative position of the document to evaluate the selector on to shift a value to this document.

Returns

TValue

The value from an expression applied to a document in a specified position relative to the current document.

Type Parameters

TInput

The type of the input documents in the partition.

TValue

The type of the selected values.

Shift<TInput, TValue>(ISetWindowFieldsPartition<TInput>, Func<TInput, TValue>, int, TValue)

Returns the value from an expression applied to a document in a specified position relative to the current document.

public static TValue Shift<TInput, TValue>(this ISetWindowFieldsPartition<TInput> partition, Func<TInput, TValue> selector, int by, TValue defaultValue)

Parameters

partition ISetWindowFieldsPartition<TInput>

The partition.

selector Func<TInput, TValue>

The selector that selects a value from the input document.

by int

The relative position of the document to evaluate the selector on to shift a value to this document.

defaultValue TValue

The default value to use if the document position is outside the partition.

Returns

TValue

The value from an expression applied to a document in a specified position relative to the current document.

Type Parameters

TInput

The type of the input documents in the partition.

TValue

The type of the selected values.