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