/* * Copyright (c) 2026, OpenSavvy and contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package opensavvy.ktmongo.sync.api.operations import opensavvy.ktmongo.dsl.command.CollectionInfo import opensavvy.ktmongo.dsl.command.ListCollectionsOptions import opensavvy.ktmongo.dsl.query.FilterQuery import opensavvy.ktmongo.sync.api.MongoIterable /** * Interface grouping MongoDB operations relating to database administration. */ interface DatabaseOperations : BaseOperations { /** * Lists the collections in this database. * * ### Example * * ```kotlin * database.collections().forEach { * println("${it.name}") * } * ``` * * ### External resources * * - [Protocol documentation](https://www.mongodb.com/docs/manual/reference/command/listcollections) * - [`mongosh` documentation](https://www.mongodb.com/docs/manual/reference/method/db.getcollectioninfos) */ fun collections( options: ListCollectionsOptions.() -> Unit = {}, filter: FilterQuery.() -> Unit = {}, ): MongoIterable }