Package-level declarations
Types
Main object used to create a MongoClient instance of the official MongoDB Kotlin sync driver, configured with the KMongo object mapping.
Functions
Aggregates documents according to the specified aggregation pipeline.
Returns a Map containing the elements from the given collection indexed by the key returned from keySelector function applied to each element.
Returns a Map containing the values provided by valueTransform and indexed by keySelector functions applied to elements of the given collection.
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.
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.
Returns an average value of elements in the collection.
Executes a mix of inserts, updates, replaces, and deletes.
Splits this collection into a list of lists each not exceeding the given size.
Counts the number of documents in the collection according to the given options.
Create an index with the given keys and options.
Removes all documents from the collection that match the given query filter. If no documents match, the collection is not modified.
Removes at most one document from the collection that matches the given filter. If no documents match, the collection is not modified.
Removes at most one document from the id parameter. If no documents match, the collection is not modified.
Returns a list containing only distinct elements from the given collection.
Gets the distinct values of the specified field name.
Gets the distinct values of the specified field.
Drops the default collection of T (see getCollection).
Drops the index given the keys used to create it.
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.
Create an index with the given keys and options. If the creation of the index is not doable because an index with the same keys but with different IndexOptions already exists, then drop the existing index and create a new one.
Create an ascending index with the given keys and options. If the creation of the index is not doable because an index with the same keys but with different IndexOptions already exists, then drop the existing index and create a new one.
Create an IndexOptions.unique index with the given keys and options. If the creation of the index is not doable because an index with the same keys but with different IndexOptions already exists, then drop the existing index and create a new one.
Sets the query filter to apply to the query.
Returns a list containing only elements matching the given predicate.
Appends all elements matching the given predicate to the given destination.
Returns a list containing all elements that are instances of specified type parameter R.
Returns a list containing all elements that are instances of specified class.
Appends all elements that are instances of specified type parameter R to the given destination.
Appends all elements that are instances of specified class to the given destination.
Appends all elements that are not null to the given destination.
Appends all elements not matching the given predicate to the given destination.
Finds all documents in the collection.
Returns the first element matching the given predicate, or null if no such element was found.
Finds the first document that match the filter in the collection.
Finds the first document that match the filters in the collection.
Atomically find a document and remove it.
Atomically find a document and replace it.
Atomically find a document and update it.
Gets a collection.
Gets a collection.
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.
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.
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.
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.
Inserts the provided document. If the document is missing an identifier, the driver should generate one.
Listens the changes of the collection indefinitely, in a (daemon) thread: a change stream that survives the errors and the invalidations.
Get all the indexes in this collection.
Get all the indexes in this collection.
Creates a $lookup pipeline stage for the specified filter (Typesafe version)
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.
Applies the given transform function to each element and its index in the original collection and appends the results to the given destination.
Applies the given transform function to each element in the original collection and appends only the non-null results to the given destination.
Returns the first element yielding the largest value of the given function or null if there are no elements.
Returns the first element having the largest value according to the provided comparator or null if there are no elements.
Returns the first element having the largest value according to the provided comparator or null if there are no elements.
Returns the first element yielding the smallest value of the given function or null if there are no elements.
Returns a list containing all elements of the original collection without the first occurrence of the given element.
Returns a list containing all elements of the original collection except the elements contained in the given elements array.
Returns a list containing all elements of the original collection except the elements contained in the given elements collection.
Returns a list containing all elements of the original collection except the elements contained in the given elements sequence.
Returns the first element having the smallest value according to the provided comparator or null if there are no elements.
Returns the first element having the smallest value according to the provided comparator or null if there are no elements.
Returns a list containing all elements of the original collection and then the given element.
Returns a list containing all elements of the original collection and then all elements of the given elements array.
Returns a list containing all elements of the original collection and then all elements of the given elements collection.
Returns a list containing all elements of the original collection and then all elements of the given elements sequence.
Sets a document describing the fields to return for all matching documents.
Returns the specified field for all matching documents.
Returns the specified two fields for all matching documents.
Returns the specified three fields for all matching documents.
Replace a document in the collection according to the specified arguments.
Replace a document in the collection according to the specified arguments.
Replace a document in the collection according to the specified arguments. Same than MongoCollection.replaceOne but ensure that any _id present in replacement is removed to avoid MongoWriteException such as: "After applying the update, the (immutable) field '_id' was found to have been altered to _id"
Executes the given command in the context of the current database with the given read preference.
Save the document. If the document has no id field, or if the document has a null id value, insert the document. Otherwise, call replaceOneById with upsert true.
Returns a new list with the elements of this list randomly shuffled.
Returns a new list with the elements of this list randomly shuffled using the specified random instance as the source of randomness.
Returns the single element, or throws an exception if the collection is empty or has more than one element.
Returns the single element matching the given predicate, or throws exception if there is no or more than one matching element.
Returns single element, or null if the collection is empty or has more than one element.
Returns the single element matching the given predicate, or null if element was not found or more than one element was found.
Returns a list of all elements sorted descending according to their natural sort order.
Returns a list of all elements sorted according to the specified comparator.
Returns the sum of all elements in the collection.
Appends all elements to the given destination collection.
Returns a new map containing all key-value pairs from the given collection of pairs.
Populates and returns the destination mutable map with key-value pairs from the given collection of pairs.
Returns a MutableList filled with all elements of this collection.
Returns a mutable set containing all distinct elements from the given collection.
Returns a SortedSet of all elements.
Update all documents in the collection according to the specified arguments.
Update a single document in the collection according to the specified arguments.
Update a single document in the collection according to the specified arguments.
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.
KMongo 4/5 compatibility: withDocumentClass was a KMongo extension, it is now a member of the official driver collection - this declaration only keeps import org.litote.kmongo.withDocumentClass valid: remove the import.
Returns a MongoIterable of IndexedValue (the index is computed at iteration time).
Returns a MongoCollection with a KMongo codec.
Returns a MongoDatabase with a KMongo codec.
Returns a list of pairs built from the elements of this collection and the other array with the same index. The returned list has length of the shortest collection.
Returns a list of pairs built from the elements of this collection and other collection with the same index. The returned list has length of the shortest collection.
Returns a list of values built from the elements of this collection and the other array with the same index using the provided transform function applied to each pair of elements. The returned list has length of the shortest collection.
Returns a list of pairs of each two adjacent elements in this collection.
Returns a list containing the results of applying the given transform function to an each pair of two adjacent elements in this collection.