rethinkdb / rethinkdb-go

Go language driver for RethinkDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When Insert data duplicated id, no error returned

codeskyblue opened this issue · comments

For example:

type Author struct {
    Id string
}

r.Table("authors").Insert(Author{Id: "12345"}).Exec(session)
err := r.Table("authors").Insert(Author{Id: "12345"}).Exec(session)
// expect err is not nil. but always nil actually

you have to use Run or RunWrite and check the Errors field to see if there was a problem with the write

Thanks @sabey , RunWrite is the right way to get error. Run still return err=nil

The command was successful, the individual query however had a conflict. If you issued multiple commands it wouldn't make sense to return a generic error for all of them.