1
0
Fork 0
arangodb/Documentation/Examples/ensureUniqueSkiplistMultiCo...

33 lines
817 B
Plaintext

arangosh> db.ids.ensureUniqueSkiplist("name.first", "name.last");
{
"id" : "ids/1182921611",
"type" : "skiplist",
"fields" : [
"name.first",
"name.last"
],
"unique" : true,
"sparse" : false,
"isNewlyCreated" : true,
"code" : 201
}
arangosh> db.ids.save({ "name" : { "first" : "hans", "last": "hansen" }});
{
"_id" : "ids/1183249291",
"_rev" : "1183249291",
"_key" : "1183249291"
}
arangosh> db.ids.save({ "name" : { "first" : "jens", "last": "jensen" }});
{
"_id" : "ids/1183445899",
"_rev" : "1183445899",
"_key" : "1183445899"
}
arangosh> db.ids.save({ "name" : { "first" : "hans", "last": "jensen" }});
{
"_id" : "ids/1183642507",
"_rev" : "1183642507",
"_key" : "1183642507"
}
[ArangoError 1210: cannot create document, unique constraint violated]