mirror of https://gitee.com/bigwinds/arangodb
fixed deleting indexes by numeric id
This commit is contained in:
parent
edc3d9bac6
commit
bed09cbbe2
|
@ -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,
|
||||
"<index-handle> must be an index-handle");
|
||||
|
|
|
@ -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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue