@@ -21,55 +21,10 @@ Creates an arbitrary index on the collection.
2121``` js
2222const db = new Database ();
2323const collection = db .collection (' some-collection' );
24- const index = await collection .createIndex ({type: ' cap ' , size : 20 });
24+ const index = await collection .createIndex ({type: ' hash ' , fields : [ ' a ' , ' a.b ' ] });
2525// the index has been created with the handle `index.id`
2626```
2727
28- ## collection.createCapConstraint
29-
30- ` async collection.createCapConstraint(size): Object `
31-
32- Creates a cap constraint index on the collection.
33-
34- ** Note** : This method is not available when using the driver with ArangoDB 3.0
35- and higher as cap constraints are no longer supported.
36-
37- ** Arguments**
38-
39- * ** size** : ` Object `
40-
41- An object with any of the following properties:
42-
43- * ** size** : ` number ` (optional)
44-
45- The maximum number of documents in the collection.
46-
47- * ** byteSize** : ` number ` (optional)
48-
49- The maximum size of active document data in the collection (in bytes).
50-
51- If _ size_ is a number, it will be interpreted as _ size.size_ .
52-
53- For more information on the properties of the _ size_ object see
54- [ the HTTP API for creating cap constraints] ( https://docs.arangodb.com/latest/HTTP/Indexes/Cap.html ) .
55-
56- ** Examples**
57-
58- ``` js
59- const db = new Database ();
60- const collection = db .collection (' some-collection' );
61-
62- const index = await collection .createCapConstraint (20 )
63- // the index has been created with the handle `index.id`
64- assert .equal (index .size , 20 );
65-
66- // -- or --
67-
68- const index = await collection .createCapConstraint ({size: 20 })
69- // the index has been created with the handle `index.id`
70- assert .equal (index .size , 20 );
71- ```
72-
7328## collection.createHashIndex
7429
7530` async collection.createHashIndex(fields, [opts]): Object `
@@ -332,3 +287,48 @@ await collection.dropIndex(index.id);
332287await collection .dropIndex (index .id .split (' /' )[1 ]);
333288// the index has been removed from the collection
334289```
290+
291+ ## collection.createCapConstraint
292+
293+ ` async collection.createCapConstraint(size): Object `
294+
295+ Creates a cap constraint index on the collection.
296+
297+ ** Note** : This method is not available when using the driver with ArangoDB 3.0
298+ and higher as cap constraints are no longer supported.
299+
300+ ** Arguments**
301+
302+ * ** size** : ` Object `
303+
304+ An object with any of the following properties:
305+
306+ * ** size** : ` number ` (optional)
307+
308+ The maximum number of documents in the collection.
309+
310+ * ** byteSize** : ` number ` (optional)
311+
312+ The maximum size of active document data in the collection (in bytes).
313+
314+ If _ size_ is a number, it will be interpreted as _ size.size_ .
315+
316+ For more information on the properties of the _ size_ object see
317+ [ the HTTP API for creating cap constraints] ( https://docs.arangodb.com/2.8/HttpIndexes/Cap.html ) .
318+
319+ ** Examples**
320+
321+ ``` js
322+ const db = new Database ();
323+ const collection = db .collection (' some-collection' );
324+
325+ const index = await collection .createCapConstraint (20 )
326+ // the index has been created with the handle `index.id`
327+ assert .equal (index .size , 20 );
328+
329+ // -- or --
330+
331+ const index = await collection .createCapConstraint ({size: 20 })
332+ // the index has been created with the handle `index.id`
333+ assert .equal (index .size , 20 );
334+ ```
0 commit comments