You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upsert does not create a new record in the database and returns null in c#
When using the create statement the record is created and can be seen in surealist. however not the same for upsert, this use to work in previous versions.
The upsert command does work when the item is created
Steps to reproduce
create a library and create a new model and use the upsert commany
`
var surrealDbClient = new SurrealDbClient(SurrealDbOptions.Create()
.WithEndpoint("ws://127.0.0.1:8000/rpc")
.WithNamespace("test")
.WithDatabase("test")
.WithUsername("root")
.WithPassword("root")
.Build());
RecordId rid = ("person", "john");
var model = new MyModel { Name = "John", Age = 25, Id = rid };
var UpsertResult = await surrealDbClient.Upsert(model);
var createResult = await surrealDbClient.Create(model);
Assert.IsTrue(createResult != null);
Assert.IsTrue(UpsertResult != null);
`
The last return false and test case fails.
Expected behaviour
a record should be created and should not be null. this also should be seen in surreallist.
yeah i was able to recreate this issue with .net example from surrealdb. i found that if i use surrealdboption to construct a connection string the upsert fails to create in the database. please see below my examples. i tried on two different computers because i thought my surrealdb was setup incorrectly.
I change these lines of code.
`//var db = new SurrealDbClient("ws://127.0.0.1:8000/rpc");
var db = new SurrealDbClient(
SurrealDbOptions
.Create()
.WithEndpoint("ws://127.0.0.1:8000/rpc")
.WithNamespace("examples")
.WithDatabase("console")
.WithUsername("root")
.WithPassword("root")
.Build()
);
Describe the bug
Upsert does not create a new record in the database and returns null in c#
When using the create statement the record is created and can be seen in surealist. however not the same for upsert, this use to work in previous versions.
The upsert command does work when the item is created
Steps to reproduce
create a library and create a new model and use the upsert commany
`
var surrealDbClient = new SurrealDbClient(SurrealDbOptions.Create()
.WithEndpoint("ws://127.0.0.1:8000/rpc")
.WithNamespace("test")
.WithDatabase("test")
.WithUsername("root")
.WithPassword("root")
.Build());
`
The last return false and test case fails.
Expected behaviour
a record should be created and should not be null. this also should be seen in surreallist.
SurrealDB version
Running 2.1.0 for macos on aarch64
Package version(s)
Contact Details
[email protected]
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: