我正在與ArangoDatabase及其驅動程序CRUD功能的小應用程序:ArangoDb.Net UPSERT總是插入
這裏是我的代碼:
var insert = new Account
{
Email = "[email protected]",
FirstName = "Adam",
LastName = "Smith"
};
var update = new Account
{
Email = "[email protected]",
FirstName = "John",
LastName = "Peterson"
};
using (var arangoDatabase = new ArangoDatabase(new DatabaseSharedSetting()
{
Url = "http://127.0.0.1:8529/",
Database = "_system",
Credential = new NetworkCredential()
{
UserName = "root",
Password = "xvxvc"
}
}))
{
arangoDatabase.Query()
.Upsert(_ => new Account() {Email = insert.Email},
_ => insert, ((aql, x) => update))
.In<Account>()
.Execute();
}
第一次運行時,[插入]對象被添加到數據庫中。 因此,我的數據庫現在是:
但在運行代碼的第二次,它會引發我一個錯誤:
unique constraint violated (while executing). ErrorNumber: 1210 HttpStatusCode: 409
的問題是:什麼是我的問題,以及如何解決這個問題?
謝謝