# Database Manual - (manual) (Part 5 of 10) > This part of the MongoDB reference continues the mongosh methods reference, plus additional server and security reference material. - [db.collection.find() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.find.md): Use the db.collection.find() method to select documents in a collection or view and return a cursor to the selected documents. See syntax and usage examples. - [db.collection.findAndModify() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.findAndModify.md): Use the mongosh db.collection.findAndModify() method to update or remove a single document and return it. Learn about syntax, options, and see code examples. - [db.collection.findOne() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOne.md): Use the mongosh db.collection.findOne() method to return one document that matches a query on a MongoDB collection or view. Learn about syntax and parameters. - [db.collection.findOneAndDelete() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndDelete.md): Use `findOneAndDelete()` to delete a document matching filter and sort criteria, returning the deleted document with optional projection and collation settings. - [db.collection.findOneAndReplace() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndReplace.md): Replace a single document in a collection using `findOneAndReplace()` with options for filtering, sorting, and projection. - [db.collection.findOneAndUpdate() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.findOneAndUpdate.md): Use the mongosh db.collection.findOneAndUpdate() method to update a single document based on filter and sort criteria. Learn about syntax and options. - [db.collection.getIndexes() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getIndexes.md): Retrieve a list of existing indexes on a MongoDB collection using the `db.collection.getIndexes()` method. - [db.collection.getPlanCache() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getPlanCache.md): Access and manage the query plan cache for a collection using `db.collection.getPlanCache()` with methods to view and clear cached query plans. - [db.collection.getSearchIndexes() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getSearchIndexes.md): Retrieve information about existing MongoDB Search indexes on a specified collection using `db.collection.getSearchIndexes()`. - [db.collection.getShardDistribution() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getShardDistribution.md): Print data distribution statistics for a sharded collection using `db.collection.getShardDistribution()`. - [db.collection.getShardLocation() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getShardLocation.md): Get the shards where a collection is located using `db.collection.getShardLocation()`. - [db.collection.getShardVersion() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.getShardVersion.md): Diagnose sharded cluster issues using the `db.collection.getShardVersion()` method, available in various MongoDB environments. - [db.collection.hideIndex() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.hideIndex.md): Hide an existing index from the query planner using `db.collection.hideIndex()` to evaluate the impact of dropping an index without actually removing it. - [db.collection.initializeOrderedBulkOp() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.initializeOrderedBulkOp.md): Initialize and execute ordered bulk write operations in MongoDB using `db.collection.initializeOrderedBulkOp()`. - [db.collection.initializeUnorderedBulkOp() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.initializeUnorderedBulkOp.md): Initialize and execute unordered bulk write operations in MongoDB using `initializeUnorderedBulkOp()`. - [db.collection.insert() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.insert.md): The insert method is deprecated should be replaced by insertOne or insertMany. - [db.collection.insertMany() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.insertMany.md): Use the mongosh db.collection.insertMany() method to insert multiple documents into a MongoDB collection. Learn about syntax, options, and see code examples. - [db.collection.insertOne() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.insertOne.md): Use the mongosh db.collection.insertOne() method to insert a single document into a MongoDB collection. Learn about syntax, options, and see code examples. - [db.collection.isCapped() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.isCapped.md): Determine if a collection is capped using the `db.collection.isCapped()` method, returning `true` for capped collections. - [db.collection.latencyStats() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.latencyStats.md): Retrieve latency statistics for a collection using `db.collection.latencyStats()`, with optional histograms for detailed latency ranges. - [db.collection.mapReduce() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.mapReduce.md): Explore alternatives to the deprecated map-reduce method in MongoDB, focusing on using aggregation pipelines for better performance and usability. - [db.collection.reIndex() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.reIndex.md): Recreate all indexes on a collection using `db.collection.reIndex()`, which is resource-intensive and only available on standalone instances. - [db.collection.remove() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.remove.md): The mongosh db.collection.remove() method is deprecated. Use db.collection.deleteOne() or db.collection.deleteMany() to remove documents from a collection. - [db.collection.renameCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.renameCollection.md): Rename a collection using `db.collection.renameCollection()` with options to drop the target collection if it exists. - [db.collection.replaceOne() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.replaceOne.md): Use the mongosh db.collection.replaceOne() method to replace a single document in a MongoDB collection based on a filter. Learn about syntax and see examples. - [db.collection.stats() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.stats.md): Retrieve collection statistics using `db.collection.stats()` with options for scaling and index details. - [db.collection.storageSize() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.storageSize.md): Determine the total storage size in bytes allocated for document storage in a MongoDB collection, reflecting compressed size if applicable. - [db.collection.totalIndexSize() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.totalIndexSize.md): Retrieve the total size of all indexes for a collection using `db.collection.totalIndexSize()`, reflecting compressed size if prefix compression is used. - [db.collection.totalSize() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.totalSize.md): Calculate the total size in bytes of a collection's data and indexes, including compressed sizes for WiredTiger storage. - [db.collection.unhideIndex() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.unhideIndex.md): Unhide an existing index from the query planner using `db.collection.unhideIndex()` in MongoDB. - [db.collection.update() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.update.md): The update method is deprecated should be replaced by updateOne or updateMany. - [db.collection.updateMany() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateMany.md): Use the mongosh db.collection.updateMany() method to update all documents that match a filter in a MongoDB collection. Learn about syntax and see examples. - [db.collection.updateOne() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateOne.md): Use the mongosh db.collection.updateOne() method to update a single document in a MongoDB collection based on a filter. Learn about syntax and see examples. - [db.collection.updateSearchIndex() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.updateSearchIndex.md): Update an existing MongoDB Search index using `db.collection.updateSearchIndex()` with specified fields and definitions. - [db.collection.validate() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.validate.md): Validate a collection for data and index correctness, with options to repair inconsistencies and check BSON conformance. - [db.collection.watch() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.collection.watch.md): Explore how to use `db.collection.watch()` to open a change stream cursor on a collection, with options for filtering and resuming streams. - [db.commandHelp() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.commandHelp.md): Use `db.commandHelp(command)` to display help text for a specified database command in MongoDB. - [db.createCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.createCollection.md): Use the db.createCollection() method to create a new collection or view, including capped collections, clustered collections, and collections with schema validation. - [db.createEncryptedCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.createEncryptedCollection.md): Create an encrypted collection in MongoDB using the db.createEncryptedCollection helper on the current database with specified encryption options. - [db.createRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.createRole.md): Create a role in a MongoDB database with specified privileges and optional authentication restrictions using `db.createRole()`. - [db.createUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.createUser.md): Create a new user in MongoDB with specified roles, authentication restrictions, and password options using the db.createUser() mongosh method in the current database. - [db.createView() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.createView.md): Create a view in MongoDB by applying an aggregation pipeline to a source collection, with options for collation settings. - [db.currentOp() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.currentOp.md): Access information on in-progress operations using `db.currentOp()`, which is deprecated in favor of `$currentOp` aggregation stage. - [db.dropAllRoles() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.dropAllRoles.md): Delete all user-defined roles from a database using `db.dropAllRoles()` with optional write concern. - [db.dropAllUsers() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.dropAllUsers.md): Remove all users from the current database using the `db.dropAllUsers()` method, with optional write concern settings. - [db.dropDatabase() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.dropDatabase.md): Use the db.dropDatabase() method to remove the current database and all its associated data files. The method also invalidates any open change streams on the database. - [db.dropRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.dropRole.md): Delete a user-defined role from a database using `db.dropRole()` with optional write concern settings. - [db.dropUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.dropUser.md): Remove a user from the current database using the `db.dropUser()` method, with optional write concern settings. - [db.fsyncLock() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.fsyncLock.md): db.fsyncLock() flushes all pending writes from the storage layer to disk and locks the server to prevent additional writes until the lock is released. - [db.fsyncUnlock() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.fsyncUnlock.md): Use the mongosh db.fsyncUnlock() method to reduce the lock count on a server and re-enable write operations after a backup. Learn about syntax and output. - [db.getCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getCollection.md): Access collections with names that conflict with `mongosh` methods using `db.getCollection(name)` to perform operations like inserts. - [db.getCollectionInfos() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getCollectionInfos.md): Retrieve collection or view information from the current database using `db.getCollectionInfos()`, with options for filtering and access control. - [db.getCollectionNames() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getCollectionNames.md): Retrieve an array of collection and view names in the current database using `db.getCollectionNames()`, considering user privileges. - [db.getLastError() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getLastError.md): Use the CRUD API with write concern for write operation success or failure information, as `db.getLastError()` is removed in MongoDB 5.1. - [db.getLastErrorObj() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getLastErrorObj.md): Use the CRUD API with write concern for write operation success or failure information, replacing `getLastError` methods. - [db.getLogComponents() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getLogComponents.md): Retrieve the current verbosity settings for log message components in MongoDB using `db.getLogComponents()`. - [db.getMongo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getMongo.md): Access the current database connection in `mongosh` using `db.getMongo()` to verify connectivity. - [db.getName() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getName.md): Use the mongosh db.getName() method to return the name of the current database in your MongoDB deployment. Learn about syntax, compatibility, and an example. - [db.getProfilingStatus() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getProfilingStatus.md): Retrieve the current profiling status, including profile level, slow operation threshold, and sample rate settings. - [db.getReplicationInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getReplicationInfo.md): Retrieve the status of a replica set using `db.getReplicationInfo()` to diagnose replication issues. - [db.getRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getRole.md): Retrieve role inheritance and privileges using `db.getRole()` in MongoDB, with options for authentication restrictions and built-in roles. - [db.getRoles() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getRoles.md): Retrieve information about all roles in a database using `db.getRoles()`, including options for privileges and authentication restrictions. - [db.getSiblingDB() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getSiblingDB.md): Access different databases in MongoDB without changing the current `db` variable using `db.getSiblingDB()`. - [db.getUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getUser.md): Retrieve user information from a database using `db.getUser()`, with options to display credentials, custom data, privileges, and authentication restrictions. - [db.getUsers() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.getUsers.md): Retrieve information for all users in a database using `db.getUsers()`, with options to filter, show credentials, or omit custom data. - [db.grantPrivilegesToRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.grantPrivilegesToRole.md): Grant additional privileges to a user-defined role using the `db.grantPrivilegesToRole()` method in MongoDB. - [db.grantRolesToRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.grantRolesToRole.md): Grant roles to a user-defined role using the `db.grantRolesToRole()` method in MongoDB. - [db.grantRolesToUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.grantRolesToUser.md): Grant additional roles to a user using the `db.grantRolesToUser()` method in MongoDB. - [db.hello() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.hello.md): Use `db.hello()` to determine the role of a `mongod` instance within a replica set, indicating if it's primary or secondary. - [db.help() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.help.md): Access a list of common methods available on the `db` object using `db.help()`. - [db.hostInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.hostInfo.md): Retrieve system information for the server running `mongod` or `mongos` using the `db.hostInfo()` method. - [db.killOp() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.killOp.md): Terminate operations using `db.killOp(opid)` with caution, ensuring you only target client-initiated operations and not internal database processes. - [db.listCommands() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.listCommands.md): Access a list of all available database commands using `db.listCommands()` in various MongoDB environments. - [db.logout() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.logout.md): Log out of the current authentication session using `db.logout()`, noting it has no effect if not authenticated. - [db.printCollectionStats() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.printCollectionStats.md): Use `db.printCollectionStats()` to manually inspect collection statistics in `mongosh`, not suitable for JSON output in scripts. - [db.printReplicationInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.printReplicationInfo.md): Print a formatted report of the replica set member's oplog using `db.printReplicationInfo()`. - [db.printSecondaryReplicationInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.printSecondaryReplicationInfo.md): Print a formatted report of replica set status from a secondary member's perspective using `db.printSecondaryReplicationInfo()`. - [db.printShardingStatus() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.printShardingStatus.md): Use `db.printShardingStatus()` to print a report of sharding configuration and chunk distribution in a sharded cluster when connected to a `mongos` instance. - [db.removeUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.removeUser.md): Use `db.dropUser()` to remove a specified username from the database, as `db.removeUser()` is deprecated. - [db.revokePrivilegesFromRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.revokePrivilegesFromRole.md): Remove specified privileges from a user-defined role using `db.revokePrivilegesFromRole()` in MongoDB. - [db.revokeRolesFromRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.revokeRolesFromRole.md): Remove specified inherited roles from a role using the `db.revokeRolesFromRole()` method in MongoDB. - [db.revokeRolesFromUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.revokeRolesFromUser.md): Remove roles from a user in the current database using the `db.revokeRolesFromUser()` method in MongoDB. - [db.rotateCertificates() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.rotateCertificates.md): Rotate TLS certificates for `mongod` or `mongos` using `db.rotateCertificates()` to apply updated configuration values. - [db.runCommand() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.runCommand.md): Run database commands with `db.runCommand()` for a consistent interface across shells and drivers, with options for read preferences and MongoDB compatibility. - [db.serverBuildInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.serverBuildInfo.md): Access build information for a `mongod` instance using the `db.serverBuildInfo()` method, compatible with Atlas, Enterprise, and Community environments. - [db.serverCmdLineOpts() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.serverCmdLineOpts.md): Retrieve the startup arguments and configuration options for a `mongod` or `mongos` instance using `db.serverCmdLineOpts()`. - [db.serverStatus() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.serverStatus.md): Retrieve an overview of the database process's state using `db.serverStatus()`, with options to customize the output. - [db.setLogLevel() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.setLogLevel.md): Set the verbosity level for log messages in MongoDB using `db.setLogLevel()` with optional component specification. - [db.setProfilingLevel() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.setProfilingLevel.md): Configure the Database Profiler in MongoDB to capture performance data, with options for setting profiling levels, slow operation thresholds, and filters. - [db.shutdownServer() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.shutdownServer.md): Shut down `mongod` or `mongos` processes safely using `db.shutdownServer()` with optional force and timeout settings. - [db.stats() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.stats.md): Retrieve database statistics using `db.stats()` to understand usage state, with options for scaling and free storage details. - [db.updateRole() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.updateRole.md): Update user-defined roles in MongoDB with `db.updateRole()`, replacing privileges and roles, and specify authentication restrictions and write concern. - [db.updateUser() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.updateUser.md): Update a user's profile in MongoDB, replacing fields like roles and custom data, with options for authentication and write concern. - [db.version() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.version.md): Retrieve the version of the `mongod` or `mongos` instance using the `db.version()` method. - [db.watch() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/db.watch.md): Open a change stream cursor for a database to monitor data changes in non-system collections using `db.watch()`. - [getClientEncryption() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/getClientEncryption.md): Access the `ClientEncryption` object for manual encryption and decryption of field values using `getClientEncryption()` in MongoDB. - [getKeyVault() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/getKeyVault.md): Access the KeyVault object for managing data encryption keys in Client-Side Field Level Encryption using the `getKeyVault()` method. - [hostname() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/hostname.md): Retrieve the hostname of the system running `mongosh` using the `hostname()` method. - [passwordPrompt() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/passwordPrompt.md): Use `passwordPrompt()` in `mongosh` to securely input passwords without displaying them in the shell. - [rs.add() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.add.md): Add a member to a replica set using `rs.add()` by specifying the host and optional configuration settings. - [rs.addArb() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.addArb.md): Add an arbiter to a replica set using `rs.addArb(host)` and ensure proper IP binding for secure access. - [rs.conf() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.conf.md): Retrieve the current replica set configuration using the `rs.conf()` method in MongoDB. - [rs.freeze() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.freeze.md): Make a replica set member ineligible to become primary for a specified duration using the `rs.freeze()` method. - [rs.help() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.help.md): Access help text for replication-related shell functions using `rs.help()`. - [rs.initiate() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.initiate.md): Initiate a replica set using `rs.initiate()` with optional configuration for MongoDB Enterprise or Community environments. - [rs.printReplicationInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.printReplicationInfo.md): Use `rs.printReplicationInfo()` to print a formatted report of a replica set member's oplog for manual inspection. - [rs.printSecondaryReplicationInfo() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.printSecondaryReplicationInfo.md): Print a formatted report of replica set status from a secondary member's perspective using `rs.printSecondaryReplicationInfo()`. - [rs.reconfig() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.reconfig.md): Reconfigure a replica set using `rs.reconfig()` to update its configuration, including options for force and maxTimeMS. - [rs.reconfigForPSASet() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.reconfigForPSASet.md): Safely reconfigure a replica set to a primary-secondary-arbiter architecture using `rs.reconfigForPSASet()`. - [rs.remove() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.remove.md): Remove a member from a replica set using `rs.remove(hostname)` and manage connections accordingly. - [rs.status() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.status.md): Retrieve the current status of a replica set using the `rs.status()` method, reflecting data from heartbeat packets. - [rs.stepDown() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.stepDown.md): Use the rs.stepDown() mongosh method to instruct a replica set primary to step down to secondary, allowing an eligible secondary to be elected as primary. - [rs.syncFrom() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/rs.syncFrom.md): Override the default sync target for a replica set member temporarily using `rs.syncFrom()`. - [sh.abortMoveCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.abortMoveCollection.md) - [sh.abortReshardCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.abortReshardCollection.md): Abort a resharding operation using `sh.abortReshardCollection()` before the commit phase in MongoDB. - [sh.abortUnshardCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.abortUnshardCollection.md) - [sh.addShard() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.addShard.md): Add a shard replica set to a sharded cluster using the `sh.addShard()` method on a `mongos` instance. - [sh.addShardTag() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.addShardTag.md): Associate shards with tags using `sh.addShardTag()` to direct chunks within tagged ranges to specific shards. - [sh.addShardToZone() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.addShardToZone.md): Associate a shard with a zone using `sh.addShardToZone()` to manage chunk distribution in sharded clusters. - [sh.addTagRange() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.addTagRange.md): Attach a range of shard key values to a shard tag using `sh.addTagRange()` for optimized initial chunk distribution in MongoDB. - [sh.balancerCollectionStatus() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.balancerCollectionStatus.md): Check if chunks in a sharded collection are balanced using the `sh.balancerCollectionStatus()` method in MongoDB. - [sh.checkMetadataConsistency() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.checkMetadataConsistency.md): Perform consistency checks on sharding metadata using `sh.checkMetadataConsistency()` to identify potential inconsistencies in the cluster. - [sh.commitReshardCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.commitReshardCollection.md): Force the completion of a resharding operation by blocking writes early using the `sh.commitReshardCollection()` method. - [sh.disableAutoMerger() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.disableAutoMerger.md): Disable automatic chunk merges for a specified namespace using the `sh.disableAutoMerger()` method in `mongosh`. - [sh.disableAutoSplit (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.disableAutoSplit.md): Disable the autosplit flag in a sharded cluster using `sh.disableAutoSplit()` from a `mongos` instance. - [sh.disableBalancing() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.disableBalancing.md): Disable the balancer for a specific sharded collection using `sh.disableBalancing()` on a `mongos` instance. - [sh.disableMigrations() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.disableMigrations.md): Disable migrations for a specified sharded collection namespace using `sh.disableMigrations()` on a `mongos` instance. - [sh.enableAutoMerger() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.enableAutoMerger.md): Enable automatic chunk merges for a specified namespace using the `sh.enableAutoMerger()` method in `mongosh`. - [sh.enableAutoSplit (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.enableAutoSplit.md): Enable the autosplit flag in a sharded cluster, though automatic chunk splitting is not performed starting in MongoDB 6.0.3. - [sh.enableBalancing() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.enableBalancing.md): Enable the balancer for a specified sharded collection namespace using `sh.enableBalancing()` on a `mongos` instance. - [sh.enableMigrations() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.enableMigrations.md): Enable migrations for a specified sharded collection namespace using `sh.enableMigrations()` on a `mongos` instance. - [sh.enableSharding() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.enableSharding.md): Enable sharding for a database using `sh.enableSharding()` in MongoDB, with optional primary shard specification. - [sh.getBalancerState() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.getBalancerState.md): Check if the balancer is enabled or disabled using `sh.getBalancerState()` in MongoDB environments. - [sh.getShardedDataDistribution() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.getShardedDataDistribution.md): Retrieve data distribution details for sharded collections using the `sh.getShardedDataDistribution()` method in a `mongosh` session. - [sh.getTransitionToDedicatedConfigServerStatus()](https://www.mongodb.com/docs/manual/reference/method/sh.getTransitionToDedicatedConfigServerStatus.md): Use the sh.getTransitionToDedicatedConfigServerStatus() method in mongosh to check the draining progress of the config shard during a transition to a dedicated config server. - [sh.help() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.help.md): Access help text for sharding-related shell functions using `sh.help()`. - [sh.isBalancerRunning() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.isBalancerRunning.md): Check if the balancer is running in MongoDB and view the status document with `sh.isBalancerRunning()`. - [sh.isConfigShardEnabled() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.isConfigShardEnabled.md) - [sh.listShards() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.listShards.md) - [sh.moveChunk() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.moveChunk.md): Use `sh.moveChunk()` to manually move a chunk to a destination shard. In most cases, you should allow the balancer to handle chunk migrations automatically. - [sh.moveCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.moveCollection.md) - [sh.moveRange() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.moveRange.md) - [sh.removeRangeFromZone() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.removeRangeFromZone.md): Remove the association between a range of shard key values and a zone using `sh.removeRangeFromZone()`. - [sh.removeShardFromZone() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.removeShardFromZone.md): Remove the association between a zone and a shard using `sh.removeShardFromZone()` in a sharded cluster. - [sh.removeShardTag() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.removeShardTag.md): Remove a tag from a shard using `sh.removeShardTag()` when connected to a `mongos` instance. - [sh.removeTagRange() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.removeTagRange.md): Remove a shard tag from a specified range of shard key values using `sh.removeTagRange()` in MongoDB. - [sh.reshardCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.reshardCollection.md): Change the shard key and data distribution for a collection using the `sh.reshardCollection()` method, with options for zones and forced redistribution. - [sh.setBalancerState() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.setBalancerState.md): Enable or disable the balancer using `sh.setBalancerState()` on a `mongos` instance, affecting shard balance and performance. - [sh.shardAndDistributeCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.shardAndDistributeCollection.md) - [sh.shardCollection() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.shardCollection.md): Shard a collection using a specified shard key to distribute documents across shards, with options for unique constraints and initial chunk distribution. - [sh.shardDrainingStatus() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.shardDrainingStatus.md): Use the sh.shardDrainingStatus() method in mongosh to check the draining progress of a specific shard, or of all draining shards, in a sharded cluster. - [sh.splitAt() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.splitAt.md): Use `sh.splitAt()` to manually split a chunk in a sharded collection at a specified shard key value. - [sh.splitFind() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.splitFind.md): Use `sh.splitFind()` to split a chunk containing a specified shard key value at its median point, creating two roughly equal chunks. - [sh.startAutoMerger() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.startAutoMerger.md): Enable the AutoMerger in MongoDB deployments to automate chunk merging with configurable time intervals. - [sh.startBalancer() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.startBalancer.md): Start the balancer in a sharded cluster using `sh.startBalancer()` with optional timeout and interval parameters. - [sh.status() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.status.md): Display a formatted report of sharding configuration and chunk information in a sharded cluster, including data distribution metrics, using `sh.status()`. - [sh.stopAutoMerger() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.stopAutoMerger.md): Disable the AutoMerger in MongoDB environments using the `sh.stopAutoMerger()` method. - [sh.stopBalancer() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.stopBalancer.md): Disable the balancer in a sharded cluster using `sh.stopBalancer()` with optional timeout and interval parameters. - [sh.unshardCollection (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.unshardCollection.md) - [sh.updateZoneKeyRange() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.updateZoneKeyRange.md): Associate a range of shard key values with a zone using `sh.updateZoneKeyRange()` in MongoDB. - [sh.waitForBalancer() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.waitForBalancer.md): Use `sh.waitForBalancer()` to monitor changes in the balancer's state, with options for wait, timeout, and interval settings. - [sh.waitForBalancerOff() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.waitForBalancerOff.md): Use `sh.waitForBalancerOff(timeout, interval)` to wait until the balancer is not running, specifying timeout and interval in milliseconds. - [sh.waitForPingChange() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sh.waitForPingChange.md): Use `sh.waitForPingChange()` to monitor changes in ping state for specified active pings with customizable timeout and interval settings. - [sp.createStreamProcessor() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.createStreamProcessor.md): Create a Stream Processor on Atlas Stream Processing Workspaces using `sp.createStreamProcessor()` with specified pipeline and options. - [sp.listConnections() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.listConnections.md) - [sp.listStreamProcessors() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.listStreamProcessors.md): Retrieve details of named stream processors on a Stream Processing Workspace using `sp.listStreamProcessors()`. - [sp.listWorkspaceDefaults() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.listWorkspaceDefaults.md): Retrieve tier information for a Stream Processing Workspace using `sp.listWorkspaceDefaults()`. - [sp.process() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.process.md): Create an ephemeral Stream Processor using `sp.process()` on Atlas Stream Processing Workspaces with customizable pipeline and options. - [sp.processor.drop() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.drop.md): Delete a named Stream Processor from the current Stream Processing Workspace using `sp.processor.drop()`. - [sp.processor.modify() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.modify.md): Use sp.processor.modify() to update the pipeline, processor name, or dead letter queue of a stopped stream processor on your Atlas Stream Processing Workspace. - [sp.processor.sample() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.sample.md): Access sampled results from a running Stream Processor using the `sp.processor.sample()` method in Atlas Stream Processing Workspaces. - [sp.processor.start() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.start.md): Start a named Stream Processor on a Stream Processing Workspace using `sp.processor.start()`. - [sp.processor.stats() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.stats.md): Retrieve statistics of a running Stream Processor using `sp.processor.stats()` with optional settings for scale and verbosity. - [sp.processor.stop() (mongosh method)](https://www.mongodb.com/docs/manual/reference/method/sp.processor.stop.md): Stop a named Stream Processor on a running Atlas Stream Processing Workspace using `sp.processor.stop()`. - [Legacy ``mongo`` Shell](https://www.mongodb.com/docs/manual/reference/mongo.md): Access legacy `mongo` shell documentation, noting its deprecation in favor of `mongosh` in MongoDB v5.0. - [Default MongoDB Read Concerns/Write Concerns](https://www.mongodb.com/docs/manual/reference/mongodb-defaults.md): Understand the default read and write concerns in MongoDB, including how to specify them at various levels using MongoDB drivers. - [MongoDB Extended JSON (v1)](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json-v1.md) - [MongoDB Extended JSON (v2)](https://www.mongodb.com/docs/manual/reference/mongodb-extended-json.md): MongoDB Extended JSON v2 extends standard JSON to preserve BSON type information. Learn about canonical and relaxed modes, supported drivers, and serialization methods. - [MongoDB Wire Protocol](https://www.mongodb.com/docs/manual/reference/mongodb-wire-protocol.md): Understand the MongoDB Wire Protocol, a socket-based request-response protocol using TCP/IP for client-server communication, with details on message types. - [MongoDB Query Language Reference](https://www.mongodb.com/docs/manual/reference/mql.md): Reference guide for the MongoDB Query Language, including query predicates, aggregation pipelines, expressions, projections, accumulators, and update operators. - [Accumulators](https://www.mongodb.com/docs/manual/reference/mql/accumulators.md) - [Aggregation Stages](https://www.mongodb.com/docs/manual/reference/mql/aggregation-stages.md): Contains a list of aggregation stages used to build aggregation pipelines. - [CRUD Commands](https://www.mongodb.com/docs/manual/reference/mql/crud-commands.md): Reference for MongoDB CRUD commands including aggregate, find, insert, update, delete, and bulkWrite. Use these commands to create, read, update, and delete documents. - [Expressions](https://www.mongodb.com/docs/manual/reference/mql/expressions.md): Explore MongoDB expressions for query and aggregation operations. Learn how to use field paths, aggregation variables, literals, and expression objects. - [Find Command Projection Operators](https://www.mongodb.com/docs/manual/reference/mql/projection.md) - [Query Predicates](https://www.mongodb.com/docs/manual/reference/mql/query-predicates.md): Learn about query predicates in MongoDB. Use these expressions to filter documents in ad-hoc CRUD commands and aggregation pipelines, including comparison, logical, array, and geospatial operators. - [Array Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/arrays.md) - [Bitwise Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/bitwise.md) - [Comparison Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/comparison.md): Learn about the comparison query operators in MongoDB. The $eq, $gt, $gte, $in, $lt, $lte, $ne, and $nin operators filter documents based on value conditions. - [Data Type Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/data-type.md) - [Geospatial Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/geospatial.md) - [Logical Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/logical.md): Learn about logical query operators in MongoDB. The $and, $not, $nor, and $or operators help you build queries based on logical conditions. - [Miscellaneous Query Predicate Operators](https://www.mongodb.com/docs/manual/reference/mql/query-predicates/misc.md) - [Update Operators](https://www.mongodb.com/docs/manual/reference/mql/update.md): Use update operators to modify MongoDB documents. You can set field values, manipulate arrays, and more. - [Configure Non-Root User Permissions](https://www.mongodb.com/docs/manual/reference/non-root-user-permissions.md): Limit the privileges of non-root users to starting, stopping, and restarting a mongod process to ensure database security.