为什么我遇到错误 "Ref expected, Object provided"?

Why I've got a error "Ref expected, Object provided"?

使用 Python API,我在集合 "spells" 中创建了一个文档,如下所示

>>> client.query(
...   q.create(
...     q.collection("spells"),
...     {
...       "data": {"name": "Mountainous Thunder", "element": "air", "cost": 15}
...     }
...   ))
{'ref': Ref(id=243802653698556416, collection=Ref(id=spells, collection=Ref(id=collections))), 'ts': 1568767179200000, 'data': {'name': 'Mountainous Thunder', 'element': 'air', 'cost': 15}}

然后,我尝试获取文档及其 ts,如下所示:

>>> client.query(q.get(q.ref(q.collection("spells", "1568767179200000"))))

但是,结果是,错误如"Ref expected, Object provided"。

>>> client.query(q.get(q.ref(q.collection("spells", "1568767179200000"))))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/dist-packages/faunadb/client.py", line 175, in query
    return self._execute("POST", "", _wrap(expression), with_txn_time=True)
  File "/usr/local/lib/python3.6/dist-packages/faunadb/client.py", line 242, in _execute
    FaunaError.raise_for_status_code(request_result)
  File "/usr/local/lib/python3.6/dist-packages/faunadb/errors.py", line 28, in raise_for_status_code
    raise BadRequest(request_result)
faunadb.errors.BadRequest: Ref expected, Object provided.

我不知道哪里出了问题,欢迎提出任何建议!

我自己解决了这个问题。我也错过了 q.ref.

的参数

正确的参数如下:

>>> client.query(q.get(q.ref(q.collection("spells"),"243802585534824962")))

{'ref': Ref(id=243802585534824962, collection=Ref(id=spells, collection=Ref(id=collections))), 'ts': 1568767114140000, 'data': {'name': 'Mountainous Thunder', 'element': 'air', 'cost': 15}}