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