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