arangosh> db.ids.ensureIndex({ type: "persistent", fields: [ "myId" ], unique: true });
{
"deduplicate" : true,
"fields" : [
"myId"
],
"id" : "ids/17574",
"isNewlyCreated" : true,
"sparse" : false,
"type" : "persistent",
"unique" : true,
"code" : 201
}
arangosh> db.ids.save({ "myId": 123 });
{
"_id" : "ids/17577",
"_key" : "17577",
"_rev" : "_Vsb0bYK---"
}
arangosh> db.ids.save({ "myId": 456 });
{
"_id" : "ids/17581",
"_key" : "17581",
"_rev" : "_Vsb0bYO---"
}
arangosh> db.ids.save({ "myId": 789 });
{
"_id" : "ids/17584",
"_key" : "17584",
"_rev" : "_Vsb0bYS---"
}
arangosh> db.ids.save({ "myId": 123 });
[ArangoError 1210: unique constraint violated - in index 17574 of type persistent over ["myId"]]