From 0f887a39fa05eabc5ea99fc254f9b9259f7471cf Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Sat, 22 Dec 2012 02:45:29 +0100 Subject: [PATCH] issue #332 --- CHANGELOG | 2 ++ arangod/VocBase/primary-collection.c | 22 ++++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 1330d73451..c5464e803c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,8 @@ v1.1.2 (XXXX-XX-XX) ------------------- +* fixed issue #332: arangoimp --use-ids parameter seems to have no impact + * added option '--server.disable-authentication' for arangosh as well. No more passwd prompts if not needed diff --git a/arangod/VocBase/primary-collection.c b/arangod/VocBase/primary-collection.c index 6a4f881626..b1999de6a9 100644 --- a/arangod/VocBase/primary-collection.c +++ b/arangod/VocBase/primary-collection.c @@ -116,10 +116,28 @@ static TRI_doc_mptr_t CreateJson (TRI_primary_collection_t* collection, TRI_json_t* id = TRI_LookupArrayJson((TRI_json_t*) json, "_id"); TRI_json_t* rev = TRI_LookupArrayJson((TRI_json_t*) json, "_rev"); - if (id != NULL && id->_type == TRI_JSON_NUMBER && + if (id != NULL && (id->_type == TRI_JSON_NUMBER || id->_type == TRI_JSON_STRING) && rev != NULL && rev->_type == TRI_JSON_NUMBER) { // read existing document id and revision id from document - did = (TRI_voc_did_t) id->_value._number; + + // did + if (id->_type == TRI_JSON_NUMBER) { + did = (TRI_voc_did_t) id->_value._number; + } + else { + TRI_vector_string_t parts = TRI_SplitString(id->_value._string.data, '/'); + if (parts._length == 1) { + did = TRI_UInt64String(parts._buffer[0]); + } + else if (parts._length == 2) { + did = TRI_UInt64String(parts._buffer[1]); + } + + LOG_INFO("using did %llu", (unsigned long long) did); + TRI_DestroyVectorString(&parts); + } + + // rid rid = (TRI_voc_rid_t) rev->_value._number; } }