我正在尝试使用文档中提供的示例访问 Fauna 数据库。但是,在下面代码中标记为“ERROR HERE”的行中,我得到了一个异常TypeError: q.Documents is not a function
。我使用 Chrome 调试器查看过,并且确定在 client.query 对象 (q) 中没有定义足够多的文档。
<script src="//cdn.jsdelivr.net/gh/fauna/faunadb-js-release@latest/faunadb-min.js"></script>
<script>
var client = new faunadb.Client({
secret: "fnAD15hPbyACANkT8jKl2Ai0AZJZWYF0q9YXT12M" // not real!
});
let q = faunadb.query;
console.log(q);
let db = q.Database('grocery_list');
console.log(db);
let collection = q.Collection('items');
console.log(collection); // this works
client.query(
q.Paginate(q.Documents(q.Collection('items')), { size: 2 }), // <-- ERROR HERE
)
.then((ret) => console.log(ret))
</script>