From 27c319b31cfa8d1f69db247ea62a43a32a9f8f7e Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Thu, 26 Nov 2015 14:08:52 +0100 Subject: [PATCH] updated array index documentation --- Documentation/Books/Users/IndexHandling/IndexBasics.mdpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/Books/Users/IndexHandling/IndexBasics.mdpp b/Documentation/Books/Users/IndexHandling/IndexBasics.mdpp index 6ad0b20689..bb23733d1e 100644 --- a/Documentation/Books/Users/IndexHandling/IndexBasics.mdpp +++ b/Documentation/Books/Users/IndexHandling/IndexBasics.mdpp @@ -269,7 +269,8 @@ way. 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 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 [\*]. +hash or skiplist index an array index, the index attribute name needs to be extended with [\*] +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 `posts`: @@ -369,3 +370,8 @@ db.posts.insert({tags: [1, 2, 3], name: "alice"}) db.posts.insert({tags: [null], name: "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.