Database Methods
Use MongoDB-backed helpers for user properties, collection queries, and application data.
User props
Simple per-user key/value storage:
Collections
Method reference
| Method | Signature | Returns |
|---|---|---|
setProp | setProp(uid, key, value) | void |
getProp | getProp(uid, key) | any |
findOne | findOne(col, query) | Document | null |
findAll | findAll(col, query) | Document[] |
updateOne | updateOne(col, filter, update) | UpdateResult |
Best practices
NxCreator exposes two ways to interact with your data: convenience helpers on the top-level db object for common patterns, and lower-level operations under db.operation for more control. Use whichever fits the task, but keep your collection names and data shapes consistent throughout your project.
For simple per-user state, prefer helpers such as setProp, getProp, and incrementProp. For structured app data like orders or products, work with explicit collections using findOne, findAll, and insertOne.
NxCreator handles the database connection layer for you. You write queries and updates, not connection management.
Last updated March 22, 2026
Was this page helpful?