1
0
Fork 0

updated array index documentation

This commit is contained in:
Jan Steemann 2015-11-26 14:08:52 +01:00
parent 1a23993f99
commit 27c319b31c
1 changed files with 7 additions and 1 deletions

View File

@ -269,7 +269,8 @@ way.
To make an index insert the individual array members into the index instead of the entire array To make an index insert the individual array members into the index instead of the entire array
value, a special array index needs to be created for the attribute. Array indexes can be set up value, a special array index needs to be created for the attribute. Array indexes can be set up
like regular hash or skiplist indexes using the `collection.ensureIndex()` function. To make a like regular hash or skiplist indexes using the `collection.ensureIndex()` function. To make a
hash or skiplist index an array index, the index attribute name needs to be extended with <i>[\*]</i>. hash or skiplist index an array index, the index attribute name needs to be extended with <i>[\*]</i>
when creating the index and when filtering in an AQL query using the `IN` operator.
The following example creates an array hash index on the `tags` attribute in a collection named The following example creates an array hash index on the `tags` attribute in a collection named
`posts`: `posts`:
@ -369,3 +370,8 @@ db.posts.insert({tags: [1, 2, 3], name: "alice"})
db.posts.insert({tags: [null], name: "bob"}) db.posts.insert({tags: [null], name: "bob"})
// Will be indexed for [null, "bob"] // Will be indexed for [null, "bob"]
``` ```
Please note that filtering using array indexes only works from within AQL queries and
only if the query filters on the indexed attribute using the `IN` operator. The other
comparison operators (`==`, `!=`, `>`, `>=`, `<`, `<=`) currently cannot use array
indexes.