diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index e086c1e509..fa9c96dcea 100644 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -6233,7 +6233,7 @@ TRI_index_t* TRI_LookupIndexByHandle (const CollectionNameResolver& resolver, assert(collection->_collection != 0); // extract the document identifier and revision from a string - if (val->IsString() || val->IsStringObject()) { + if (val->IsString() || val->IsStringObject() || val->IsNumber()) { if (! IsIndexHandle(val, collectionName, iid)) { *err = TRI_CreateErrorObject(TRI_ERROR_ARANGO_INDEX_HANDLE_BAD, " must be an index-handle"); diff --git a/js/common/tests/shell-index.js b/js/common/tests/shell-index.js index a59d4ab053..ce49093b80 100644 --- a/js/common/tests/shell-index.js +++ b/js/common/tests/shell-index.js @@ -141,6 +141,34 @@ function indexSuite() { assertEqual(false, res); }, +//////////////////////////////////////////////////////////////////////////////// +/// @brief drop index by id string +//////////////////////////////////////////////////////////////////////////////// + + testDropIndexString : function () { + // pick up the numeric part (starts after the slash) + var id = collection.ensureGeoIndex("a").id.substr(cn.length + 1); + var res = collection.dropIndex(collection.name() + "/" + id); + assertEqual(true, res); + + res = collection.dropIndex(collection.name() + "/" + id); + assertEqual(false, res); + + id = collection.ensureGeoIndex("a").id.substr(cn.length + 1); + res = collection.dropIndex(parseInt(id, 10)); + assertEqual(true, res); + + res = collection.dropIndex(parseInt(id, 10)); + assertEqual(false, res); + + id = collection.ensureGeoIndex("a").id.substr(cn.length + 1); + res = internal.db._dropIndex(collection.name() + "/" + id); + assertEqual(true, res); + + res = internal.db._dropIndex(collection.name() + "/" + id); + assertEqual(false, res); + }, + //////////////////////////////////////////////////////////////////////////////// /// @brief access a non-existing index ////////////////////////////////////////////////////////////////////////////////