Documentation
API Reference
Database

Database API

Path-based document database.

Create/Update

POST /api/db
Authorization: Bearer <token>
Content-Type: application/json
 
{
  "collection": "users/user_123",
  "data": {
    "name": "John",
    "email": "john@example.com"
  }
}

Read

GET /api/db?collection=users/user_123
Authorization: Bearer <token>

Update Field

PUT /api/db?collection=users/user_123
Content-Type: application/json
 
{
  "oldKey": "status",
  "newKey": "status",
  "value": "verified",
  "type": "string"
}

Delete Document

DELETE /api/db?collection=users/user_123
Authorization: Bearer <token>

Delete Field

DELETE /api/db?collection=users/user_123&field=phone
Authorization: Bearer <token>

SDK Example

await moon.db.set('users/user_123', { name: 'John' });
const user = await moon.db.get('users/user_123');
await moon.db.updateField('users/user_123', 'status', 'verified');
await moon.db.delete('users/user_123');