Skip to content

Commit 4e9e782

Browse files
committed
Implemented edgeCollection(autoCreate). Fixes #29.
1 parent 7deba35 commit 4e9e782

File tree

9 files changed

+399
-245
lines changed

9 files changed

+399
-245
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,28 @@ db.collection('potatos', function (err, collection) {
171171
});
172172
```
173173

174+
#### database.edgeCollection
175+
176+
`database.edgeCollection(collectionName: string, [autoCreate: boolean,] [callback: Callback]): Promise<EdgeCollection>`
177+
178+
Fetches the edge collection with the given *collectionName* from the database, then passes a new *EdgeCollection* instance to the callback.
179+
180+
If *autoCreate* is set to `true`, an edge collection with the given name will be created if it doesn't already exist.
181+
182+
If a collection with the given name exists but isn't an edge collection, an apropriate error will be passed instead.
183+
184+
```js
185+
var db = require('arangojs')();
186+
db.collection('potatos', function (err, collection) {
187+
if (err) {
188+
// Collection did not exist
189+
console.error(err);
190+
return;
191+
}
192+
// collection exists
193+
});
194+
```
195+
174196
#### database.collections
175197

176198
`database.collections([callback: Callback]): Promise<Array<Collection>>`

0 commit comments

Comments
 (0)