File: motor_collection.py

package info (click to toggle)
python-odmantic 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,488 kB
  • sloc: python: 8,646; sh: 110; javascript: 45; makefile: 34; xml: 13
file content (25 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from odmantic import AIOEngine, Model


class User(Model):
    name: str


engine = AIOEngine()
motor_collection = engine.get_collection(User)
print(motor_collection)
#> AsyncIOMotorCollection(
#>     Collection(
#>         Database(
#>             MongoClient(
#>                 host=["localhost:27017"],
#>                 document_class=dict,
#>                 tz_aware=False,
#>                 connect=False,
#>                 driver=DriverInfo(name="Motor", version="2.2.0", platform="asyncio"),
#>             ),
#>             "test",
#>         ),
#>         "user",
#>     )
#> )