all |
Returns fun <T> MongoIterable<T>.all(predicate: (T) -> Boolean): Boolean |
any |
Returns fun <T> MongoIterable<T>.any(): Boolean
Returns fun <T> MongoIterable<T>.any(predicate: (T) -> Boolean): Boolean |
asSequence |
Creates a Sequence instance that wraps the original collection returning its elements when being iterated. fun <T> MongoIterable<T>.asSequence(): Sequence<T> |
associate |
Returns a Map containing key-value pairs provided by transform function applied to elements of the given collection. fun <T, K, V> MongoIterable<T>.associate(transform: (T) -> Pair<K, V>): Map<K, V> |
associateBy |
Returns a Map containing the elements from the given collection indexed by the key returned from keySelector function applied to each element. fun <T, K> MongoIterable<T>.associateBy(keySelector: (T) -> K): Map<K, T>
Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given collection. fun <T, K, V> MongoIterable<T>.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, V> |
associateByTo |
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function applied to each element of the given collection and value is the element itself. fun <T, K, M : MutableMap<in K, in T>> MongoIterable<T>.associateByTo(destination: M, keySelector: (T) -> K): M
Populates and returns the destination mutable map with key-value pairs, where key is provided by the keySelector function and and value is provided by the valueTransform function applied to elements of the given collection. fun <T, K, V, M : MutableMap<in K, in V>> MongoIterable<T>.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M |
associateTo |
Populates and returns the destination mutable map with key-value pairs provided by transform function applied to each element of the given collection. fun <T, K, V, M : MutableMap<in K, in V>> MongoIterable<T>.associateTo(destination: M, transform: (T) -> Pair<K, V>): M |
average |
Returns an average value of elements in the collection. fun MongoIterable<Byte>.average(): Double fun MongoIterable<Short>.average(): Double fun MongoIterable<Int>.average(): Double fun MongoIterable<Long>.average(): Double fun MongoIterable<Float>.average(): Double fun MongoIterable<Double>.average(): Double |
chunked |
Splits this collection into a list of lists each not exceeding the given size. fun <T> MongoIterable<T>.chunked(size: Int): List<List<T>>
Splits this collection into several lists each not exceeding the given size and applies the given transform function to an each. fun <T, R> MongoIterable<T>.chunked(size: Int, transform: (List<T>) -> R): List<R> |
contains |
Returns operator fun <T> MongoIterable<T>.contains(element: T): Boolean |
count |
Returns the number of elements in this collection. fun <T> MongoIterable<T>.count(): Int
Returns the number of elements matching the given predicate. fun <T> MongoIterable<T>.count(predicate: (T) -> Boolean): Int |
distinct |
Returns a list containing only distinct elements from the given collection. fun <T> MongoIterable<T>.distinct(): List<T> |
distinctBy |
Returns a list containing only elements from the given collection having distinct keys returned by the given selector function. fun <T, K> MongoIterable<T>.distinctBy(selector: (T) -> K): List<T> |
drop |
Returns a list containing all elements except first n elements. fun <T> MongoIterable<T>.drop(n: Int): List<T> |
dropWhile |
Returns a list containing all elements except first elements that satisfy the given predicate. fun <T> MongoIterable<T>.dropWhile(predicate: (T) -> Boolean): List<T> |
elementAt |
Returns an element at the given index or throws an IndexOutOfBoundsException if the index is out of bounds of this collection. fun <T> MongoIterable<T>.elementAt(index: Int): T |
elementAtOrElse |
Returns an element at the given index or the result of calling the defaultValue function if the index is out of bounds of this collection. fun <T> MongoIterable<T>.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T |
elementAtOrNull |
Returns an element at the given index or fun <T> MongoIterable<T>.elementAtOrNull(index: Int): T? |
filter |
Returns a list containing only elements matching the given predicate. fun <T> MongoIterable<T>.filter(predicate: (T) -> Boolean): List<T> |
filterIndexed |
Returns a list containing only elements matching the given predicate. fun <T> MongoIterable<T>.filterIndexed(predicate: (index: Int, T) -> Boolean): List<T> |
filterIndexedTo |
Appends all elements matching the given predicate to the given destination. fun <T, C : MutableCollection<in T>> MongoIterable<T>.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C |
filterIsInstance |
Returns a list containing all elements that are instances of specified type parameter R. fun <R> MongoIterable<*>.filterIsInstance(): List<R>
Returns a list containing all elements that are instances of specified class. fun <R> MongoIterable<*>.filterIsInstance(klass: Class<R>): List<R> |
filterIsInstanceTo |
Appends all elements that are instances of specified type parameter R to the given destination. fun <R, C : MutableCollection<in R>> MongoIterable<*>.filterIsInstanceTo(destination: C): C
Appends all elements that are instances of specified class to the given destination. fun <C : MutableCollection<in R>, R> MongoIterable<*>.filterIsInstanceTo(destination: C, klass: Class<R>): C |
filterNot |
Returns a list containing all elements not matching the given predicate. fun <T> MongoIterable<T>.filterNot(predicate: (T) -> Boolean): List<T> |
filterNotNull |
Returns a list containing all elements that are not fun <T : Any> MongoIterable<T?>.filterNotNull(): List<T> |
filterNotNullTo |
Appends all elements that are not fun <C : MutableCollection<in T>, T : Any> MongoIterable<T?>.filterNotNullTo(destination: C): C |
filterNotTo |
Appends all elements not matching the given predicate to the given destination. fun <T, C : MutableCollection<in T>> MongoIterable<T>.filterNotTo(destination: C, predicate: (T) -> Boolean): C |
filterTo |
Appends all elements matching the given predicate to the given destination. fun <T, C : MutableCollection<in T>> MongoIterable<T>.filterTo(destination: C, predicate: (T) -> Boolean): C |
find |
Returns the first element matching the given predicate, or fun <T> MongoIterable<T>.find(predicate: (T) -> Boolean): T? |
findLast |
Returns the last element matching the given predicate, or fun <T> MongoIterable<T>.findLast(predicate: (T) -> Boolean): T? |
first |
Returns the first element matching the given predicate. fun <T> MongoIterable<T>.first(predicate: (T) -> Boolean): T |
firstOrNull |
Returns the first element, or fun <T> MongoIterable<T>.firstOrNull(): T?
Returns the first element matching the given predicate, or fun <T> MongoIterable<T>.firstOrNull(predicate: (T) -> Boolean): T? |
flatMap |
Returns a single list of all elements yielded from results of transform function being invoked on each element of original collection. fun <T, R> MongoIterable<T>.flatMap(transform: (T) -> MongoIterable<R>): List<R> |
flatMapTo |
Appends all elements yielded from results of transform function being invoked on each element of original collection, to the given destination. fun <T, R, C : MutableCollection<in R>> MongoIterable<T>.flatMapTo(destination: C, transform: (T) -> MongoIterable<R>): C |
flatten |
Returns a single list of all elements from all collections in the given collection. fun <T> MongoIterable<Iterable<T>>.flatten(): List<T> |
fold |
Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each element. fun <T, R> MongoIterable<T>.fold(initial: R, operation: (acc: R, T) -> R): R |
foldIndexed |
Accumulates value starting with initial value and applying operation from left to right to current accumulator value and each element with its index in the original collection. fun <T, R> MongoIterable<T>.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R |
forEach |
Overrides Iterable.forEach to ensure MongoIterable.forEach is called. fun <T> MongoIterable<T>.forEach(action: (T) -> Unit): Unit |
forEachIndexed |
Performs the given action on each element, providing sequential index with the element. fun <T> MongoIterable<T>.forEachIndexed(action: (index: Int, T) -> Unit): Unit |
groupBy |
Groups elements of the original collection by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements. fun <T, K> MongoIterable<T>.groupBy(keySelector: (T) -> K): Map<K, List<T>>
Groups values returned by the valueTransform function applied to each element of the original collection by the key returned by the given keySelector function applied to the element and returns a map where each group key is associated with a list of corresponding values. fun <T, K, V> MongoIterable<T>.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map<K, List<V>> |
groupByTo |
Groups elements of the original collection by the key returned by the given keySelector function applied to each element and puts to the destination map each group key associated with a list of corresponding elements. fun <T, K, M : MutableMap<in K, MutableList<T>>> MongoIterable<T>.groupByTo(destination: M, keySelector: (T) -> K): M
Groups values returned by the valueTransform function applied to each element of the original collection by the key returned by the given keySelector function applied to the element and puts to the destination map each group key associated with a list of corresponding values. fun <T, K, V, M : MutableMap<in K, MutableList<V>>> MongoIterable<T>.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M |
groupingBy(Since:1.1 ) |
Creates a Grouping source from a collection to be used later with one of group-and-fold operations using the specified keySelector function to extract a key from each element. fun <T, K> MongoIterable<T>.groupingBy(keySelector: (T) -> K): Grouping<T, K> |
indexOf |
Returns first index of element, or -1 if the collection does not contain element. fun <T> MongoIterable<T>.indexOf(element: T): Int |
indexOfFirst |
Returns index of the first element matching the given predicate, or -1 if the collection does not contain such element. fun <T> MongoIterable<T>.indexOfFirst(predicate: (T) -> Boolean): Int |
indexOfLast |
Returns index of the last element matching the given predicate, or -1 if the collection does not contain such element. fun <T> MongoIterable<T>.indexOfLast(predicate: (T) -> Boolean): Int |
intersect |
Returns a set containing all elements that are contained by both this set and the specified collection. infix fun <T> MongoIterable<T>.intersect(other: Iterable<T>): Set<T> |
joinTo |
Appends the string from all the elements separated using separator and using the given prefix and postfix if supplied. fun <T, A : Appendable> MongoIterable<T>.joinTo(buffer: A, separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): A |
joinToString |
Creates a string from all the elements separated using separator and using the given prefix and postfix if supplied. fun <T> MongoIterable<T>.joinToString(separator: CharSequence = ", ", prefix: CharSequence = "", postfix: CharSequence = "", limit: Int = -1, truncated: CharSequence = "...", transform: ((T) -> CharSequence)? = null): String |
last |
Returns the last element. fun <T> MongoIterable<T>.last(): T
Returns the last element matching the given predicate. fun <T> MongoIterable<T>.last(predicate: (T) -> Boolean): T |
lastIndexOf |
Returns last index of element, or -1 if the collection does not contain element. fun <T> MongoIterable<T>.lastIndexOf(element: T): Int |
lastOrNull |
Returns the last element, or fun <T> MongoIterable<T>.lastOrNull(): T?
Returns the last element matching the given predicate, or fun <T> MongoIterable<T>.lastOrNull(predicate: (T) -> Boolean): T? |
map |
Returns a list containing the results of applying the given transform function to each element in the original collection. fun <T, R> MongoIterable<T>.map(transform: (T) -> R): List<R> |
mapIndexed |
Returns a list containing the results of applying the given transform function to each element and its index in the original collection. fun <T, R> MongoIterable<T>.mapIndexed(transform: (index: Int, T) -> R): List<R> |
mapIndexedNotNull |
Returns a list containing only the non-null results of applying the given transform function to each element and its index in the original collection. fun <T, R : Any> MongoIterable<T>.mapIndexedNotNull(transform: (index: Int, T) -> R?): List<R> |
mapIndexedNotNullTo |
Applies the given transform function to each element and its index in the original collection and appends only the non-null results to the given destination. fun <T, R : Any, C : MutableCollection<in R>> MongoIterable<T>.mapIndexedNotNullTo(destination: C, transform: (index: Int, T) -> R?): C |
mapIndexedTo |
Applies the given transform function to each element and its index in the original collection and appends the results to the given destination. fun <T, R, C : MutableCollection<in R>> MongoIterable<T>.mapIndexedTo(destination: C, transform: (index: Int, T) -> R): C |
mapNotNull |
Returns a list containing only the non-null results of applying the given transform function to each element in the original collection. fun <T, R : Any> MongoIterable<T>.mapNotNull(transform: (T) -> R?): List<R> |
mapNotNullTo |
Applies the given transform function to each element in the original collection and appends only the non-null results to the given destination. fun <T, R : Any, C : MutableCollection<in R>> MongoIterable<T>.mapNotNullTo(destination: C, transform: (T) -> R?): C |
mapTo |
Applies the given transform function to each element of the original collection and appends the results to the given destination. fun <T, R, C : MutableCollection<in R>> MongoIterable<T>.mapTo(destination: C, transform: (T) -> R): C |
max |
Returns the largest element or fun MongoIterable<Double>.max(): Double? fun MongoIterable<Float>.max(): Float? fun <T : Comparable<T>> MongoIterable<T>.max(): T? |
maxBy |
Returns the first element yielding the largest value of the given function or fun <T, R : Comparable<R>> MongoIterable<T>.maxBy(selector: (T) -> R): T? |
maxByOrNull |
Returns the first element yielding the largest value of the given function or fun <T, R : Comparable<R>> MongoIterable<T>.maxByOrNull(selector: (T) -> R): T? |
maxOrNull |
Returns the largest element or fun MongoIterable<Double>.maxOrNull(): Double? fun MongoIterable<Float>.maxOrNull(): Float? fun <T : Comparable<T>> MongoIterable<T>.maxOrNull(): T? |
maxWith |
Returns the first element having the largest value according to the provided comparator or fun <T> MongoIterable<T>.maxWith(comparator: <ERROR CLASS><in T>): T? |
maxWithOrNull |
Returns the first element having the largest value according to the provided comparator or fun <T> MongoIterable<T>.maxWithOrNull(comparator: <ERROR CLASS><in T>): T? |
min |
Returns the smallest element or fun MongoIterable<Double>.min(): Double? fun MongoIterable<Float>.min(): Float? fun <T : Comparable<T>> MongoIterable<T>.min(): T? |
minBy |
Returns the first element yielding the smallest value of the given function or fun <T, R : Comparable<R>> MongoIterable<T>.minBy(selector: (T) -> R): T? |
minByOrNull |
Returns the first element yielding the smallest value of the given function or fun <T, R : Comparable<R>> MongoIterable<T>.minByOrNull(selector: (T) -> R): T? |
minOrNull |
Returns the smallest element or fun MongoIterable<Double>.minOrNull(): Double? fun MongoIterable<Float>.minOrNull(): Float? fun <T : Comparable<T>> MongoIterable<T>.minOrNull(): T? |
minus |
Returns a list containing all elements of the original collection without the first occurrence of the given element. operator fun <T> MongoIterable<T>.minus(element: T): List<T>
Returns a list containing all elements of the original collection except the elements contained in the given elements array. operator fun <T> MongoIterable<T>.minus(elements: Array<out T>): List<T>
Returns a list containing all elements of the original collection except the elements contained in the given elements collection. operator fun <T> MongoIterable<T>.minus(elements: Iterable<T>): List<T>
Returns a list containing all elements of the original collection except the elements contained in the given elements sequence. operator fun <T> MongoIterable<T>.minus(elements: Sequence<T>): List<T> |
minusElement |
Returns a list containing all elements of the original collection without the first occurrence of the given element. fun <T> MongoIterable<T>.minusElement(element: T): List<T> |
minWith |
Returns the first element having the smallest value according to the provided comparator or fun <T> MongoIterable<T>.minWith(comparator: <ERROR CLASS><in T>): T? |
minWithOrNull |
Returns the first element having the smallest value according to the provided comparator or fun <T> MongoIterable<T>.minWithOrNull(comparator: <ERROR CLASS><in T>): T? |
none |
Returns fun <T> MongoIterable<T>.none(): Boolean
Returns fun <T> MongoIterable<T>.none(predicate: (T) -> Boolean): Boolean |
partition |
Splits the original collection into pair of lists,
where first list contains elements for which predicate yielded fun <T> MongoIterable<T>.partition(predicate: (T) -> Boolean): Pair<List<T>, List<T>> |
plus |
Returns a list containing all elements of the original collection and then the given element. operator fun <T> MongoIterable<T>.plus(element: T): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements array. operator fun <T> MongoIterable<T>.plus(elements: Array<out T>): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements collection. operator fun <T> MongoIterable<T>.plus(elements: Iterable<T>): List<T>
Returns a list containing all elements of the original collection and then all elements of the given elements sequence. operator fun <T> MongoIterable<T>.plus(elements: Sequence<T>): List<T> |
plusElement |
Returns a list containing all elements of the original collection and then the given element. fun <T> MongoIterable<T>.plusElement(element: T): List<T> |
reduce |
Accumulates value starting with the first element and applying operation from left to right to current accumulator value and each element. fun <S, T : S> MongoIterable<T>.reduce(operation: (acc: S, T) -> S): S |
reduceIndexed |
Accumulates value starting with the first element and applying operation from left to right to current accumulator value and each element with its index in the original collection. fun <S, T : S> MongoIterable<T>.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S |
requireNoNulls |
Returns an original collection containing all the non- fun <T : Any> MongoIterable<T?>.requireNoNulls(): Iterable<T> |
reversed |
Returns a list with elements in reversed order. fun <T> MongoIterable<T>.reversed(): List<T> |
shuffled |
Returns a new list with the elements of this list randomly shuffled. fun <T> MongoIterable<T>.shuffled(): List<T>
Returns a new list with the elements of this list randomly shuffled using the specified random instance as the source of randomness. fun <T> MongoIterable<T>.shuffled(random: Random): List<T> |
single |
Returns the single element, or throws an exception if the collection is empty or has more than one element. fun <T> MongoIterable<T>.single(): T
Returns the single element matching the given predicate, or throws exception if there is no or more than one matching element. fun <T> MongoIterable<T>.single(predicate: (T) -> Boolean): T |
singleOrNull |
Returns single element, or fun <T> MongoIterable<T>.singleOrNull(): T?
Returns the single element matching the given predicate, or fun <T> MongoIterable<T>.singleOrNull(predicate: (T) -> Boolean): T? |
sorted |
Returns a list of all elements sorted according to their natural sort order. fun <T : Comparable<T>> MongoIterable<T>.sorted(): List<T> |
sortedBy |
Returns a list of all elements sorted according to natural sort order of the value returned by specified selector function. fun <T, R : Comparable<R>> MongoIterable<T>.sortedBy(selector: (T) -> R?): List<T> |
sortedByDescending |
Returns a list of all elements sorted descending according to natural sort order of the value returned by specified selector function. fun <T, R : Comparable<R>> MongoIterable<T>.sortedByDescending(selector: (T) -> R?): List<T> |
sortedDescending |
Returns a list of all elements sorted descending according to their natural sort order. fun <T : Comparable<T>> MongoIterable<T>.sortedDescending(): List<T> |
sortedWith |
Returns a list of all elements sorted according to the specified comparator. fun <T> MongoIterable<T>.sortedWith(comparator: <ERROR CLASS><in T>): List<T> |
subtract |
Returns a set containing all elements that are contained by this collection and not contained by the specified collection. infix fun <T> MongoIterable<T>.subtract(other: Iterable<T>): Set<T> |
sum |
Returns the sum of all elements in the collection. fun MongoIterable<Byte>.sum(): Int fun MongoIterable<Short>.sum(): Int fun MongoIterable<Int>.sum(): Int fun MongoIterable<Long>.sum(): Long fun MongoIterable<Float>.sum(): Float fun MongoIterable<Double>.sum(): Double |
sumBy |
Returns the sum of all values produced by selector function applied to each element in the collection. fun <T> MongoIterable<T>.sumBy(selector: (T) -> Int): Int |
sumByDouble |
Returns the sum of all values produced by selector function applied to each element in the collection. fun <T> MongoIterable<T>.sumByDouble(selector: (T) -> Double): Double |
take |
Returns a list containing first n elements. fun <T> MongoIterable<T>.take(n: Int): List<T> |
takeWhile |
Returns a list containing first elements satisfying the given predicate. fun <T> MongoIterable<T>.takeWhile(predicate: (T) -> Boolean): List<T> |
toCollection |
Appends all elements to the given destination collection. fun <T, C : MutableCollection<in T>> MongoIterable<T>.toCollection(destination: C): C |
toHashSet |
Returns a HashSet of all elements. fun <T> MongoIterable<T>.toHashSet(): <ERROR CLASS><T> |
toList |
Returns a List containing all elements. fun <T> MongoIterable<T>.toList(): List<T> |
toMap |
Returns a new map containing all key-value pairs from the given collection of pairs. fun <K, V> MongoIterable<Pair<K, V>>.toMap(): Map<K, V>
Populates and returns the destination mutable map with key-value pairs from the given collection of pairs. fun <K, V, M : MutableMap<in K, in V>> MongoIterable<Pair<K, V>>.toMap(destination: M): M |
toMutableList |
Returns a MutableList filled with all elements of this collection. fun <T> MongoIterable<T>.toMutableList(): MutableList<T> |
toMutableSet |
Returns a mutable set containing all distinct elements from the given collection. fun <T> MongoIterable<T>.toMutableSet(): MutableSet<T> |
toSet |
Returns a Set of all elements. fun <T> MongoIterable<T>.toSet(): Set<T> |
toSortedSet |
Returns a SortedSet of all elements. fun <T : Comparable<T>> MongoIterable<T>.toSortedSet(): SortedSet<T> fun <T> MongoIterable<T>.toSortedSet(comparator: <ERROR CLASS><in T>): SortedSet<T> |
union |
Returns a set containing all distinct elements from both collections. infix fun <T> MongoIterable<T>.union(other: Iterable<T>): Set<T> |
unzip |
Returns a pair of lists, where first list is built from the first values of each pair from this collection, second list is built from the second values of each pair from this collection. fun <T, R> MongoIterable<Pair<T, R>>.unzip(): Pair<List<T>, List<R>> |
useCursor |
Utility method - this is not part of the KMongo public API. fun <T, R> MongoIterable<T>.useCursor(block: (Iterable<T>) -> R): R |
windowed |
Returns a list of snapshots of the window of the given size sliding along this collection with the given step, where each snapshot is a list. fun <T> MongoIterable<T>.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false): List<List<T>>
Returns a list of results of applying the given transform function to an each list representing a view over the window of the given size sliding along this collection with the given step. fun <T, R> MongoIterable<T>.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (List<T>) -> R): List<R> |
withIndex |
Returns a lazy Iterable of IndexedValue for each element of the original collection. fun <T> MongoIterable<T>.withIndex(): MongoIterable<IndexedValue<T>> |
zip |
Returns a list of pairs built from the elements of infix fun <T, R> MongoIterable<T>.zip(other: Array<out R>): List<Pair<T, R>>
Returns a list of values built from the elements of fun <T, R, V> MongoIterable<T>.zip(other: Array<out R>, transform: (a: T, b: R) -> V): List<V>
Returns a list of pairs built from the elements of infix fun <T, R> MongoIterable<T>.zip(other: Iterable<R>): List<Pair<T, R>>
Returns a list of values built from the elements of fun <T, R, V> MongoIterable<T>.zip(other: Iterable<R>, transform: (a: T, b: R) -> V): List<V> |
zipWithNext |
Returns a list of pairs of each two adjacent elements in this collection. fun <T> MongoIterable<T>.zipWithNext(): List<Pair<T, T>>
Returns a list containing the results of applying the given transform function to an each pair of two adjacent elements in this collection. fun <T, R> MongoIterable<T>.zipWithNext(transform: (a: T, b: T) -> R): List<R> |