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