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