Exemplo n.º 1
0
            /// <summary>
            /// Removes one or more documents from a collection. If no documents match the <paramref name="filter"/>, the collection is not modified.
            /// </summary>
            /// <param name="filter">
            /// A document describing the deletion criteria using <see href="https://docs.mongodb.com/manual/reference/operator/query/">query operators</see>.
            /// If not specified, all documents in the collection will be deleted.
            /// </param>
            /// <returns>
            /// An awaitable <see cref="Task{T}"/> representing the remote delete many operation. The result of the task contains the number
            /// of deleted documents.
            /// </returns>
            /// <seealso href="https://docs.mongodb.com/manual/reference/method/db.collection.deleteMany/"/>
            public async Task <DeleteResult> DeleteManyAsync(object filter = null)
            {
                var result = await _handle.DeleteMany(filter?.ToNativeJson());

                return(result.GetValue <DeleteResult>());
            }