Schema Creation π§±
urBackend is powered by a dynamic schema engine. You can define your data structure visually in the dashboard, and our API will automatically enforce validation, provide type safety, and even generate your Admin UI.
Supported Data Types
Every field in your collection must have a type. Here are the types urBackend supports:
String
Alphanumeric text data.
"title": "Hello World"
Number
Integers or decimals.
"price": 19.99
Boolean
true or false values.
"isActive": true
Date
Any valid date or ISO string.
"createdAt": "2024-03-07"
Object
Nested JSON structure.
"meta": { "views": 10 }
Array
A list of values.
"tags": ["tech", "ai"]
Ref
Reference to another document ID.
"author": "642f9..."
Type Matching Rules (important)
Stringfields must receive strings ("42"is valid,42is not).Numberfields must receive numbers.Booleanfields must receivetrue/false.Objectfields must receive JSON objects.Arrayfields must receive arrays.Reffields should store valid MongoDB ObjectId strings referencing the target collection.
1. Required Fields β οΈ
When you toggle a field as Required in the dashboard, the API will reject any POST or PUT request that doesn't include that field. This ensures your database always has the data your application needs.
2. Nested Objects π¦
You can create complex, hierarchical data structures by using the Object type.
In the Dashboard: Add a field, set type to
Object, then add "Sub-fields" inside it.In the API: Send a normal nested JSON object.
3. Arrays π
The Array type allows you to store lists of values.
In the Dashboard: Set type to
Array.In the API: Send a standard JSON array
[].
4. References (Ref/Lookup) π
References allow you to link documents between collections (similar to foreign keys or Joins).
Setup: Set type to
Refand choose the target collection.Usage: Store the
_idof the document you want to link to.Benefit: This enables you to build relational data structures while keeping the flexibility of NoSQL.
[!TIP] Always define your "users" collection schema manually before enabling Authentication to ensure your custom user fields (like
avatarorrole) are properly validated.
[!IMPORTANT] For Auth,
usersmust include requiredpasswordstring fields.
Last updated
