mirror of https://gitee.com/bigwinds/arangodb
issue #281
This commit is contained in:
parent
c8b18a338a
commit
9c167a734f
|
@ -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 }
|
|
@ -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
|
|
@ -3477,7 +3477,7 @@ static v8::Handle<v8::Value> 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<v8::Value> JS_EnsureUniqueSkiplistVocbaseCol (v8::Arguments const& argv) {
|
||||
|
@ -3505,7 +3505,7 @@ static v8::Handle<v8::Value> 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<v8::Value> JS_EnsureSkiplistVocbaseCol (v8::Arguments const& argv) {
|
||||
|
|
|
@ -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
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
Loading…
Reference in New Issue