NxCreateDocs

Database Methods

Use MongoDB-backed helpers for user properties, collection queries, and application data.

User props

Simple per-user key/value storage:

await db.setProp(userId, 'credits', 100);
const credits = await db.getProp(userId, 'credits');
await db.incrementProp(userId, 'credits', -10);

Collections

const user = await db.findOne('users', { userId });
const userViaOperation = await db.operation.findOne('users', { userId });

await db.insertOne('orders', { userId, amount: 50 });
const orders = await db.findAll('orders', { status: 'pending' });

Method reference

MethodSignatureReturns
setPropsetProp(uid, key, value)void
getPropgetProp(uid, key)any
findOnefindOne(col, query)Document | null
findAllfindAll(col, query)Document[]
updateOneupdateOne(col, filter, update)UpdateResult

Guidance

The legacy docs exposed both direct database methods and convenience helpers under db.operation. Use whichever version matches the task, but keep your schema and collection names consistent.

For simple per-user state, prefer helpers such as setProp, getProp, and incrementProp. For structured app data, work with explicit collections.

NxCreator handles the database connection layer for you. You write queries and updates, not connection management.

How did this page feel?

Quick feedback helps improve the docs.

Last updated March 22, 2026
NxCreator, Inc.
Build and operate Telegram bots with a managed runtime.