Hi @MikeZheng-3371 If you are looking to empty all documents in Cosmos DB Mongo DB you can create a TTL index using the MongoDB shell.
globaldb:PRIMARY> db.coll.createIndex({"_ts":1}, {expireAfterSeconds: 10})
{
"_t" : "CreateIndexesResponse",
"ok" : 1,
"createdCollectionAutomatically" : true,
"numIndexesBefore" : 1,
"numIndexesAfter" : 4
}
The command in the above example will create an index with TTL functionality. Once the index is created, the database will automatically delete any documents in that collection that have not been modified in the last 10 seconds. Expire data with Azure Cosmos DB's API for MongoDB
You will need to drop the index once all documents are deleted in the collection. db.collection.dropIndex()
Please let me know if this is what you are looking for.
Regards,
Oury