arangosh> db.ids.ensureIndex({ type: "persistent", fields: [ "myId" ], unique: true });
{
"deduplicate" : true,
"fields" : [
"myId"
],
"id" : "ids/111787",
"isNewlyCreated" : true,
"sparse" : false,
"type" : "persistent",
"unique" : true,
"code" : 201
}
arangosh> db.ids.save({ "myId": 123 });
{
"_id" : "ids/111790",
"_key" : "111790",
"_rev" : "_YYClXge--_"
}
arangosh> db.ids.save({ "myId": 456 });
{
"_id" : "ids/111794",
"_key" : "111794",
"_rev" : "_YYClXge--B"
}
arangosh> db.ids.save({ "myId": 789 });
{
"_id" : "ids/111797",
"_key" : "111797",
"_rev" : "_YYClXgi--_"
}
arangosh> db.ids.save({ "myId": 123 });
[ArangoError 1210: unique constraint violated - in index 111787 of type persistent over ["myId"]; conflicting key: 111790]