Creating collections

This assumes you’ve got a Database object available which can be constructed or accessed from a Server.

try database.createCollection(named: "myCollectionName")

This also accepts database options which are described here. The provided collection name is used for the key “create”.

Dropping/removing databases and collections

try database.drop() or try collection.drop() will allow you to drop a database’s or collection’s contents.

Modifying collections

This requires flags to be provided as a Document. All available flags can be found here.

try collection.set(flags: flags)