Optional. 可选。A user-provided comment to attach to this command. 用户提供了附加到此命令的注释。Once set, this comment appears alongside records of this command in the following locations:设置后,此注释将与此命令的记录一起显示在以下位置:
Starting in MongoDB 5.0, the drop command and the db.collection.drop() method will raise an error if passed an unrecognized parameter. 从MongoDB 5.0开始,如果传递了无法识别的参数,drop命令和db.collection.drop()方法将引发错误。In MongoDB 4.4 and earlier, unrecognized parameters are silently ignored.在MongoDB 4.4及更早版本中,未识别的参数被默默忽略。
This command also removes any indexes associated with the dropped collection.此命令还删除与删除的集合关联的所有索引。
Starting in MongoDB 4.4, the db.collection.drop() method and drop command abort any in-progress index builds on the target collection before dropping the collection. 从MongoDB 4.4开始,db.collection.drop()方法和drop命令在删除集合之前中止在目标集合上构建的任何正在进行的索引。Prior to MongoDB 4.4, attempting to drop a collection with in-progress index builds results in an error, and the collection is not dropped.在MongoDB 4.4之前,尝试删除正在进行索引构建的集合会导致错误,并且不会删除该集合。For replica sets or shard replica sets, aborting an index on the primary does not simultaneously abort secondary index builds. 对于副本集或分片副本集,中止主索引不会同时中止辅助索引生成。MongoDB attempts to abort the in-progress builds for the specified indexes on the primary and if successful creates an associated abortoplog entry. MongoDB尝试中止primary上指定索引的正在进行的构建,如果成功,将创建一个关联的abort日志条目。Secondary members with replicated in-progress builds wait for a commit or abort oplog entry from the primary before either committing or aborting the index build.具有复制的正在进行的构建的Secondary成员在提交或中止索引构建之前,等待来自主数据库的提交或中止oplog条目。
drop obtains an exclusive lock on the specified collection for the duration of the operation. 在操作期间获取指定集合的独占锁。All subsequent operations on the collection must wait until drop releases the lock.对集合的所有后续操作都必须等到drop释放锁。
Prior to MongoDB 4.2, drop obtained an exclusive lock on the parent database, blocking all operations on the database and all its collections until the operation completed.在MongoDB 4.2之前,drop获得了父数据库的独占锁,在操作完成之前阻止对数据库及其所有集合的所有操作。