Zio.Mongo()
Read‑only. This is a place to view collected data, so writing is not possible — if you look at another set and infer from Zio.mongo(...).create(...) that there is none. To compare with the net, see the table in Zio.Database (Overview).
MongoDB 조회
Section titled “MongoDB 조회”MongoDB databases can be queried easily for dynamically created user-defined collection data and retrieved as a GraphResult object.
| Method | Description |
|---|---|
Zio.mongo(collection_name) |
Retrieves user-defined collection data created in MongoDB and returns it in the form of a GraphResult. |
Example: Querying MongoDB Data (main.py)
Section titled “Example: Querying MongoDB Data (main.py)”from zio_ontology import Ziofrom fastapi import FastAPIfrom fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/api/mongo/{collection}")async def run_mongo(collection: str): result = Zio.mongo(collection) return JSONResponse(content={"data": result.data})When calling a non‑existent collection
Section titled “When calling a non‑existent collection”You will get a
LookupError— it says “there is no such collection”, not “no data”. If you conflate the two, a typo in the name may be interpreted as an “empty result”, so callers keep trying by slightly changing the name. Collections are created by the collection pipeline — they cannot be created here.Therefore do not guess the name; first call
Zio.mongo.list(). It returns[{name, description, columns[]}]— only readable collections appear, so a missing name will also raise aLookupErrorinZio.mongo().