diff --git a/Documentation/Examples/multi-skiplist b/Documentation/Examples/multi-skiplist new file mode 100644 index 0000000000..5f7f7e8684 --- /dev/null +++ b/Documentation/Examples/multi-skiplist @@ -0,0 +1,13 @@ +arangod> db.names.ensureSkiplist("first"); +{ "id" : "41349252/42725508", "unique" : false, "type" : "skiplist", "fields" : ["first"], "isNewlyCreated" : true } + +arangod> db.names.save({ "first" : "Tim" }); +{ "_id" : "41349252/42856580", "_rev" : 42856580 } +arangod> db.names.save({ "first" : "Tom" }); +{ "_id" : "41349252/42922116", "_rev" : 42922116 } +arangod> db.names.save({ "first" : "John" }); +{ "_id" : "41349252/42987652", "_rev" : 42987652 } +arangod> db.names.save({ "first" : "Tim" }); +{ "_id" : "41349252/43053188", "_rev" : 43053188 } +arangod> db.names.save({ "first" : "Tom" }); +{ "_id" : "41349252/43118724", "_rev" : 43118724 } diff --git a/Documentation/Examples/unique-skiplist b/Documentation/Examples/unique-skiplist new file mode 100644 index 0000000000..470907f7e3 --- /dev/null +++ b/Documentation/Examples/unique-skiplist @@ -0,0 +1,34 @@ +arangod> db.ids.ensureUniqueSkiplist("myId"); +{ "id" : "41236104/42612360", "unique" : true, "type" : "skiplist", "fields" : ["myId"], "isNewlyCreated" : true } + +arangod> db.ids.save({ "myId": 123 }); +{ "_id" : "41236104/42743432", "_rev" : 42743432 } +arangod> db.ids.save({ "myId": 456 }); +{ "_id" : "41236104/42808968", "_rev" : 42808968 } +arangod> db.ids.save({ "myId": 789 }); +{ "_id" : "41236104/42874504", "_rev" : 42874504 } + +arangod> db.ids.save({ "myId": 123 }); +JavaScript exception in file '(arango)' at 1,8: [ArangoError 1210: cannot save document: unique constraint violated] +!db.ids.save({ "myId": 123 }); +! ^ +stacktrace: [ArangoError 1210: cannot save document: unique constraint violated] + at (arango):1:8 + + +arangod> db.ids.ensureUniqueSkiplist("name.first", "name.last"); +{ "id" : "41236104/43362549", "unique" : true, "type" : "skiplist", "fields" : ["name.first", "name.last"], "isNewlyCreated" : true } + +arangod> db.ids.save({ "name" : { "first" : "hans", "last": "hansen" }}); +{ "_id" : "41236104/43755765", "_rev" : 43755765, "_key" : "43755765" } +arangod> db.ids.save({ "name" : { "first" : "jens", "last": "jensen" }}); +{ "_id" : "41236104/43821301", "_rev" : 43821301, "_key" : "43821301" } +arangod> db.ids.save({ "name" : { "first" : "hans", "last": "jensen" }}); +{ "_id" : "41236104/43886837", "_rev" : 43886837, "_key" : "43886837" } + +arangod> db.ids.save({ "name" : { "first" : "hans", "last": "hansen" }}); +JavaScript exception in file '(arango)' at 1,8: [ArangoError 1210: cannot save document: unique constraint violated] +!db.ids.save({"name" : {"first" : "hans", "last": "hansen" }}); +! ^ +stacktrace: [ArangoError 1210: cannot save document: unique constraint violated] + at (arango):1:8 diff --git a/arangod/V8Server/v8-vocbase.cpp b/arangod/V8Server/v8-vocbase.cpp index bbf32514c9..1fd5aaa62a 100755 --- a/arangod/V8Server/v8-vocbase.cpp +++ b/arangod/V8Server/v8-vocbase.cpp @@ -3477,7 +3477,7 @@ static v8::Handle JS_EnsurePriorityQueueIndexVocbaseCol (v8::Argument /// In case that the index was successfully created, the index identifier /// is returned. /// -/// @verbinclude fluent14 +/// @verbinclude unique-skiplist //////////////////////////////////////////////////////////////////////////////// static v8::Handle JS_EnsureUniqueSkiplistVocbaseCol (v8::Arguments const& argv) { @@ -3505,7 +3505,7 @@ static v8::Handle JS_LookupUniqueSkiplistVocbaseCol (v8::Arguments co /// In case that the index was successfully created, the index identifier /// is returned. /// -/// @verbinclude fluent14 +/// @verbinclude multi-skiplist //////////////////////////////////////////////////////////////////////////////// static v8::Handle JS_EnsureSkiplistVocbaseCol (v8::Arguments const& argv) { diff --git a/js/actions/system/api-index.js b/js/actions/system/api-index.js index 8794d7aa1f..38b2700f9b 100644 --- a/js/actions/system/api-index.js +++ b/js/actions/system/api-index.js @@ -482,13 +482,9 @@ function POST_api_index_skiplist (req, res, collection, body) { /// If the @FA{collection-identifier} is unknown, then a @LIT{HTTP 404} is /// returned. It is possible to specify a name instead of an identifier. /// -/// If the collection already contains documents and you try to create a unique -/// skip-list index in such a way that there are documents violating the -/// uniqueness, then a @LIT{HTTP 400} is returned. -/// /// @EXAMPLES /// -/// Creating a skiplist: +/// Creating a bitarray index: /// /// @verbinclude api-index-create-new-bitarray ////////////////////////////////////////////////////////////////////////////////