Skip to content

Commit 6aff8a0

Browse files
committed
Fixed #19.
1 parent 02540c7 commit 6aff8a0

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2534,10 +2534,12 @@ db.createGraph({
25342534
});
25352535
```
25362536

2537-
#### graphEdgeCollection.save(data, fromId, toId, callback)
2537+
#### graphEdgeCollection.save(data, [fromId, toId, ]callback)
25382538

25392539
Creates a new edge between the vertices *fromId* and *toId* with the given *data*.
25402540

2541+
If *fromId* and *toId* are not specified, the *data* needs to contain the properties *_from* and *_to*.
2542+
25412543
*Examples*
25422544

25432545
```js

dist/arango.all.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,13 @@ extend(EdgeCollection.prototype, {
13031303
});
13041304
},
13051305
save: function (data, fromId, toId, callback) {
1306+
if (typeof fromId === 'function') {
1307+
callback = fromId;
1308+
fromId = undefined;
1309+
} else {
1310+
data._from = fromId;
1311+
data._to = toId;
1312+
}
13061313
if (!callback)
13071314
callback = noop;
13081315
this._gharial.post(data, {

dist/arango.all.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/arango.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,6 +1303,13 @@ extend(EdgeCollection.prototype, {
13031303
});
13041304
},
13051305
save: function (data, fromId, toId, callback) {
1306+
if (typeof fromId === 'function') {
1307+
callback = fromId;
1308+
fromId = undefined;
1309+
} else {
1310+
data._from = fromId;
1311+
data._to = toId;
1312+
}
13061313
if (!callback)
13071314
callback = noop;
13081315
this._gharial.post(data, {

dist/arango.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/graph.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ extend(EdgeCollection.prototype, {
126126
});
127127
},
128128
save: function (data, fromId, toId, callback) {
129+
if (typeof fromId === 'function') {
130+
callback = fromId;
131+
fromId = undefined;
132+
} else {
133+
data._from = fromId;
134+
data._to = toId;
135+
}
129136
if (!callback) callback = noop;
130137
this._gharial.post(data, {
131138
collection: this.name,

0 commit comments

Comments
 (0)