Skip to content

Commit 0fac132

Browse files
committed
Some examples
1 parent 461b49b commit 0fac132

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

src/collection.ts

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,7 +2009,35 @@ export interface DocumentCollection<T extends object = any>
20092009
*
20102010
* @example
20112011
* ```js
2012-
* TODO
2012+
* const db = new Database();
2013+
* const collection = db.collection("some-collection");
2014+
* // const ids = await collection.list("id");
2015+
* const ids = await db.query(aql`
2016+
* FOR doc IN ${collection}
2017+
* RETURN doc._id
2018+
* `);
2019+
* ```
2020+
*
2021+
* @example
2022+
* ```js
2023+
* const db = new Database();
2024+
* const collection = db.collection("some-collection");
2025+
* // const keys = await collection.list("key");
2026+
* const keys = await db.query(aql`
2027+
* FOR doc IN ${collection}
2028+
* RETURN doc._key
2029+
* `);
2030+
* ```
2031+
*
2032+
* @example
2033+
* ```js
2034+
* const db = new Database();
2035+
* const collection = db.collection("some-collection");
2036+
* // const paths = await collection.list("path");
2037+
* const paths = await db.query(aql`
2038+
* FOR doc IN ${collection}
2039+
* RETURN CONCAT("/_db/", CURRENT_DATABASE(), "/_api/document/", doc._id)
2040+
* `);
20132041
* ```
20142042
*/
20152043
list(type?: SimpleQueryListType): Promise<ArrayCursor<string>>;
@@ -2024,7 +2052,13 @@ export interface DocumentCollection<T extends object = any>
20242052
*
20252053
* @example
20262054
* ```js
2027-
* TODO
2055+
* const db = new Database();
2056+
* const collection = db.collection("some-collection");
2057+
* // const cursor = await collection.all();
2058+
* const cursor = await db.query(aql`
2059+
* FOR doc IN ${collection}
2060+
* RETURN doc
2061+
* `);
20282062
* ```
20292063
*/
20302064
all(options?: SimpleQueryAllOptions): Promise<ArrayCursor<Document<T>>>;

0 commit comments

Comments
 (0)