arangosh> db.ids.ensureIndex({ type: "persistent", fields: [ "myId" ], unique: true });
{
"deduplicate" : true,
"fields" : [
"myId"
],
"id" : "ids/17585",
"isNewlyCreated" : true,
"sparse" : false,
"type" : "persistent",
"unique" : true,
"code" : 201
}
arangosh> db.ids.save({ "myId": 123 });
{
"_id" : "ids/17588",
"_key" : "17588",
"_rev" : "_VvTSGKu---"
}
arangosh> db.ids.save({ "myId": 456 });
{
"_id" : "ids/17592",
"_key" : "17592",
"_rev" : "_VvTSGKu--_"
}
arangosh> db.ids.save({ "myId": 789 });
{
"_id" : "ids/17595",
"_key" : "17595",
"_rev" : "_VvTSGKu--A"
}
arangosh> db.ids.save({ "myId": 123 });
[ArangoError 1210: unique constraint violated - in index 17585 of type persistent over ["myId"]]