Collection Options
When creating a collection you can pass a configuration object to customize its behavior.
const users = db.collection({
name: 'users',
autoId: true,
idField: '_id',
idType: 'auto',
indexes: ['email', 'city'],
pretty: true,
lazy: false
});
| Option | Default | Description |
|---|---|---|
name | — | Required. Name of the collection. |
autoId | false | Automatically generate an ID for new documents. |
idField | '_id' | Field name used for the ID (supports nested paths). |
idType | 'auto' | 'auto' | 'uuid' | 'objectid' |
indexes | [] | Array of field names to index. |
pretty | true | Pretty-print the JSON files. |
lazy | false | Reserved for future lazy-loading behavior. |
Next: See the full API Reference.