You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-7Lines changed: 51 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1413,10 +1413,29 @@ If *opts* is set, it must be an object with any of the following properties:
1413
1413
* if *policy* is set to `"last"`, the document will be replaced regardless of the revision.
1414
1414
* if *policy* is set to `"error"` or not set, the replacement will fail with an error.
1415
1415
1416
-
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection.
1416
+
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection, or a document (i.e. an object with an `_id` or `_key` property).
1417
1417
1418
1418
For more information on the *opts* object, see [the HTTP API documentation for working with documents](https://docs.arangodb.com/HttpDocument/WorkingWithDocuments.html).
1419
1419
1420
+
*Examples*
1421
+
1422
+
```js
1423
+
var db =require('arangojs')();
1424
+
db.collection('some-collection', function (err, collection) {
1425
+
if (err) returnconsole.error(err);
1426
+
collection.save({number:1, hello:'world'}, function (err, doc) {
1427
+
if (err) returnconsole.error(err);
1428
+
collection.replace(doc, {number:2}, function (err, doc2) {
Updates (merges) the content of the document with the given *documentHandle* with the given *data*.
@@ -1431,10 +1450,29 @@ If *opts* is set, it must be an object with any of the following properties:
1431
1450
* if *policy* is set to `"last"`, the document will be replaced regardless of the revision.
1432
1451
* if *policy* is set to `"error"` or not set, the replacement will fail with an error.
1433
1452
1434
-
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection.
1453
+
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection, or a document (i.e. an object with an `_id` or `_key` property).
1435
1454
1436
1455
For more information on the *opts* object, see [the HTTP API documentation for working with documents](https://docs.arangodb.com/HttpDocument/WorkingWithDocuments.html).
1437
1456
1457
+
*Examples*
1458
+
1459
+
```js
1460
+
var db =require('arangojs')();
1461
+
db.collection('some-collection', function (err, collection) {
1462
+
if (err) returnconsole.error(err);
1463
+
collection.save({number:1, hello:'world'}, function (err, doc) {
1464
+
if (err) returnconsole.error(err);
1465
+
collection.update(doc, {number:2}, function (err, doc2) {
Deletes the document with the given *documentHandle* from the collection.
@@ -1447,7 +1485,7 @@ If *opts* is set, it must be an object with any of the following properties:
1447
1485
* if *policy* is set to `"last"`, the document will be replaced regardless of the revision.
1448
1486
* if *policy* is set to `"error"` or not set, the replacement will fail with an error.
1449
1487
1450
-
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection.
1488
+
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection, or a document (i.e. an object with an `_id` or `_key` property).
1451
1489
1452
1490
For more information on the *opts* object, see [the HTTP API documentation for working with documents](https://docs.arangodb.com/HttpDocument/WorkingWithDocuments.html).
1453
1491
@@ -1487,7 +1525,7 @@ The *DocumentCollection API* extends the [*Collection API* (see above)](#collect
1487
1525
1488
1526
Retrieves the document with the given *documentHandle* from the collection.
1489
1527
1490
-
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection.
1528
+
The *documentHandle* can be either the `_id` or the `_key` of a document in the collection, or a document (i.e. an object with an `_id` or `_key` property).
1491
1529
1492
1530
*Examples*
1493
1531
@@ -1542,7 +1580,7 @@ The *EdgeCollection API* extends the [*Collection API* (see above)](#collection-
1542
1580
1543
1581
Retrieves the edge with the given *documentHandle* from the collection.
1544
1582
1545
-
The *documentHandle* can be either the `_id` or the `_key` of an edge in the collection.
1583
+
The *documentHandle* can be either the `_id` or the `_key` of an edge in the collection, or an edge (i.e. an object with an `_id` or `_key` property).
1546
1584
1547
1585
*Examples*
1548
1586
@@ -1598,6 +1636,8 @@ db.createEdgeCollection('my-edges', function (err, collection) {
1598
1636
1599
1637
Retrieves a list of all edges of the document with the given *documentHandle*.
1600
1638
1639
+
The *documentHandle* can be either the `_id` or the `_key` of a document in any collection, or a document (i.e. an object with an `_id` or `_key` property).
1640
+
1601
1641
*Examples*
1602
1642
1603
1643
```js
@@ -1625,6 +1665,8 @@ db.createEdgeCollection('my-edges', function (err, collection) {
1625
1665
1626
1666
Retrieves a list of all incoming edges of the document with the given *documentHandle*.
1627
1667
1668
+
The *documentHandle* can be either the `_id` or the `_key` of a document in any collection, or a document (i.e. an object with an `_id` or `_key` property).
1669
+
1628
1670
*Examples*
1629
1671
1630
1672
```js
@@ -1652,6 +1694,8 @@ db.createEdgeCollection('my-edges', function (err, collection) {
1652
1694
1653
1695
Retrieves a list of all outgoing edges of the document with the given *documentHandle*.
1654
1696
1697
+
The *documentHandle* can be either the `_id` or the `_key` of a document in any collection, or a document (i.e. an object with an `_id` or `_key` property).
1698
+
1655
1699
*Examples*
1656
1700
1657
1701
```js
@@ -1771,7 +1815,7 @@ The *GraphVertexCollection API* extends the [*Collection API* (see above)](#coll
1771
1815
1772
1816
Retrieves the vertex with the given *documentHandle* from the collection.
1773
1817
1774
-
The *documentHandle* can be either the `_id` or the `_key` of a vertex in the collection.
1818
+
The *documentHandle* can be either the `_id` or the `_key` of a vertex in the collection, or a vertex (i.e. an object with an `_id` or `_key` property).
1775
1819
1776
1820
#### graphVertexCollection.save(data, callback)
1777
1821
@@ -1785,7 +1829,7 @@ The *GraphEdgeCollection API* extends the *Collection API* (see above) with the
1785
1829
1786
1830
Retrieves the edge with the given *documentHandle* from the collection.
1787
1831
1788
-
The *documentHandle* can be either the `_id` or the `_key` of an edge in the collection.
1832
+
The *documentHandle* can be either the `_id` or the `_key` of an edge in the collection, or an edge (i.e. an object with an `_id` or `_key` property).
0 commit comments