Skip to content

Commit 037ac02

Browse files
dothebartpluma
authored andcommitted
move cap constraint docu to the end of the file, link 2.8 docu which … (#549)
* move cap constraint docu to the end of the file, link 2.8 docu which is the last to support this * link -> 2.8 * Fix cap index link
1 parent 5275cad commit 037ac02

File tree

1 file changed

+46
-46
lines changed

1 file changed

+46
-46
lines changed

docs/Drivers/JS/Reference/Collection/Indexes.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -21,55 +21,10 @@ Creates an arbitrary index on the collection.
2121
```js
2222
const db = new Database();
2323
const 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);
332287
await 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

Comments
 (0)