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