File: many_to_many_1.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 (7 lines) | stat: -rw-r--r-- 314 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
book = await engine.find_one(Book, Book.title == "Python Cookbook")
authors = await engine.find(Author, Author.id.in_(book.author_ids))
print(authors)
#> [
#>   Author(id=ObjectId("5f7a37dc7311be1362e1da4e"), name="David Beazley"),
#>   Author(id=ObjectId("5f7a37dc7311be1362e1da4f"), name="Brian K. Jones"),
#> ]