SQL (Alchemy)
Type
Database Collection
= GraphQL Type
Collection | Model | Type
import dbcontroller as dbc
mongo = dbc.Controller(mongo="mongodb://localhost:27017/example")
# Types
@mongo.model
class User:
name: str
notes: dbc.text
meta: dbc.json
disabled: bool = False
Manager
C.U.D — Examples
Reading | Querying (One-Record)
Reading | Querying (Multiple-Records)
results = await table.all()
query = {"$or": [
{"name": {"$regex": "joe"}},
{"name": {"$regex": "jane"}}
]}
results = await table.find(query, page=1, limit=100, sort_by="-id")
query = {"name": "joe doe"}
results = await table.filter_by(search=query, page=1, limit=100, sort_by="-id")
search_value = "j"
columns = ["name", "notes"]
results = await table.search(columns=columns, value=search_value, page=1, limit=100, sort_by="-id")