arangosh> db.ids.ensureIndex({ type: "persistent", fields: [ "myId" ], unique: true });
{
"deduplicate" : true,
"fields" : [
"myId"
],
"id" : "ids/18576",
"isNewlyCreated" : true,
"sparse" : false,
"type" : "persistent",
"unique" : true,
"code" : 201
}
arangosh> db.ids.save({ "myId": 123 });
{
"_id" : "ids/18579",
"_key" : "18579",
"_rev" : "_XGh_ZSa--_"
}
arangosh> db.ids.save({ "myId": 456 });
{
"_id" : "ids/18583",
"_key" : "18583",
"_rev" : "_XGh_ZSi--_"
}
arangosh> db.ids.save({ "myId": 789 });
{
"_id" : "ids/18586",
"_key" : "18586",
"_rev" : "_XGh_ZSm--_"
}
arangosh> db.ids.save({ "myId": 123 });
[ArangoError 1210: unique constraint violated - in index 18576 of type persistent over ["myId"]; conflicting key: 18579]