| |
show wiki show source compare to current compare to previous read history
createCollection()
MongoDB Driver Function Reference
Creates a collection.
More information can be found in the corresponding entry of the MongoDB Manual.
db.createCollection(name[, <options>])
|
Arguments
name | | Collection name |
<options> | | A BOSN document specifying options |
|
Options
{ capped: collation: <document>, <boolean>, size: <number>, max: <number>, storageEngine: <document>,
validationLevel: <string>, validationAction: <string>, indexOptionDefaults: <document> }
collation | | A document specifying the collation |
capped | | Creates a capped collection. Must also specify size (default: false) |
size | | Specifies the size of a capped collection |
max | | Specifies the maximum number of documents in a capped collection |
storageEngine | | Specifies a storage engine |
indexOptionDefaults | | Specifies the default index options |
|
Example
db.createCollection("employees");
|
Creates a collection named employees.
home | MongoDB Driver Function Reference | MongoDB Driver
|