arangosh> db.ids.ensureIndex({ type: "persistent", fields: [ "myId" ], unique: true });
{
"deduplicate" : true,
"fields" : [
"myId"
],
"id" : "ids/74158",
"isNewlyCreated" : true,
"name" : "idx_1641835679923044352",
"selectivityEstimate" : 1,
"sparse" : false,
"type" : "persistent",
"unique" : true,
"code" : 201
}
arangosh> db.ids.save({ "myId": 123 });
{
"_id" : "ids/74162",
"_key" : "74162",
"_rev" : "_ZG8Lmfa---"
}
arangosh> db.ids.save({ "myId": 456 });
{
"_id" : "ids/74164",
"_key" : "74164",
"_rev" : "_ZG8Lmfa--A"
}
arangosh> db.ids.save({ "myId": 789 });
{
"_id" : "ids/74166",
"_key" : "74166",
"_rev" : "_ZG8Lmfa--C"
}
arangosh> db.ids.save({ "myId": 123 });
[ArangoError 1210: unique constraint violated - in index idx_1641835679923044352 of type persistent over 'myId'; conflicting key: 74162]