> For the complete documentation index, see [llms.txt](https://moonlightdb.js.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://moonlightdb.js.org/docs/database/createcollection.md).

# createCollection()

Creates a new collection where data will be stored

## Example

```javascript
db.createCollection("users").then(() => {
    console.log("createCollection:", "ok");
}).catch((error) => {
    console.log("error:", error);
});
```

### createCollection(name)

| Parameter | Description                                                                                                                                        |
| --------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| name      | <p><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a><br>The name for the collection</p> |
