Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Get certain documents by reference.
def get_by_ref_id(collection, id):
try:
serverClient = FaunaClient(secret=os.environ.get("FAUNA_SERVER_SECRET"))
res = serverClient.query(q.get(q.ref(q.collection(collection), id)))
res["data"]["ref_id"] = res["ref"].id()
return res["data"]
except Exception as ex:
raise ex
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment