Comments (8)
Hi @fiLLLip , what NuGet version are you currently using?
from rethinkdb.driver.
2.2.0-beta-2
from rethinkdb.driver.
Could you supply the JSON protocol traces associated with the queries? It would really help debug the issue.
from rethinkdb.driver.
Is this what you are looking for?
from rethinkdb.driver.
I see the problem here. It's not the result that yields null, but result.Changes... result.replaced returns 1 😄 Closing this 👍
from rethinkdb.driver.
Hey @fiLLLip ,
I wrote a quick example:
[Test]
public void issue_20()
{
var table = r.db(DbName).table(TableName);
table.delete().run(conn);
Console.WriteLine("INSERT");
var result = table.insert(new {foo = "bar"}).runResult(conn);
var id = result.GeneratedKeys[0];
result.AssertInserted(1);
Console.WriteLine("UPDATE 1 / VALUE 1");
var value = "VALUE1";
result = table.get(id).update(new {Target = value}).runResult(conn);
result.Dump();
Console.WriteLine("UPDATE 2 / VALUE 2");
value = "VALUE2";
var optResult = table.get(id).update(new {Target = value})
.optArg("return_changes", true).run(conn);
ExtensionsForTesting.Dump(optResult);
}
The full JSON trace I got back for the example above is:
INSERT
TRACE JSON Send: Token: 4, JSON: [1,[56,[[15,[[14,["query"]],"test"]],{"foo":"bar"}]],{}]
TRACE JSON Recv: Token: 4, JSON: {"t":1,"r":[{"deleted":0,"errors":0,"generated_keys":["d6180360-e9b6-4403-be3b-234af9458fe0"],"inserted":1,"replaced":0,"skipped":0,"unchanged":0}]}
UPDATE 1 / VALUE 1
TRACE JSON Send: Token: 5, JSON: [1,[53,[[16,[[15,[[14,["query"]],"test"]],"d6180360-e9b6-4403-be3b-234af9458fe0"]],{"Target":"VALUE1"}]],{}]
TRACE JSON Recv: Token: 5, JSON: {"t":1,"r":[{"deleted":0,"errors":0,"inserted":0,"replaced":1,"skipped":0,"unchanged":0}]}
{
"generated_keys": null,
"Inserted": 0,
"Replaced": 1,
"Unchanged": 0,
"Errors": 0,
"first_error": null,
"Deleted": 0,
"Skipped": 0,
"Warnings": null,
"Changes": null,
"Ready": null,
"dbs_created": 0,
"dbs_dropped": 0,
"tables_created": 0,
"tables_dropped": 0
}
UPDATE 2 / VALUE 2
TRACE JSON Send: Token: 6, JSON: [1,[53,[[16,[[15,[[14,["query"]],"test"]],"d6180360-e9b6-4403-be3b-234af9458fe0"]],{"Target":"VALUE2"}],{"return_changes":true}],{}]
TRACE JSON Recv: Token: 6, JSON: {"t":1,"r":[{"changes":[{"new_val":{"Target":"VALUE2","foo":"bar","id":"d6180360-e9b6-4403-be3b-234af9458fe0"},"old_val":{"Target":"VALUE1","foo":"bar","id":"d6180360-e9b6-4403-be3b-234af9458fe0"}}],"deleted":0,"errors":0,"inserted":0,"replaced":1,"skipped":0,"unchanged":0}]}
{
"changes": [
{
"new_val": {
"Target": "VALUE2",
"foo": "bar",
"id": "d6180360-e9b6-4403-be3b-234af9458fe0"
},
"old_val": {
"Target": "VALUE1",
"foo": "bar",
"id": "d6180360-e9b6-4403-be3b-234af9458fe0"
}
}
],
"deleted": 0,
"errors": 0,
"inserted": 0,
"replaced": 1,
"skipped": 0,
"unchanged": 0
}
Query 1
UPDATE 1 query:
result = table.get(id).update(new {Target = value}).runResult(conn);
we got back a response:
{"t":1,"r":[{"deleted":0,"errors":0,"inserted":0,"replaced":1,"skipped":0,"unchanged":0}]}
There is no Changes
key to parse, so it's null in Result
.
Query 2
UPDATE 2 query:
var optResult = table.get(id).update(new {Target = value})
.optArg("return_changes", true).run(conn);
{"t":1,"r":[{"changes":[{"new_val":{"Target":"VALUE2","foo":"bar","id":"d6180360-e9b6-4403-be3b-234af9458fe0"},"old_val":{"Target":"VALUE1","foo":"bar","id":"d6180360-e9b6-4403-be3b-234af9458fe0"}}],"deleted":0,"errors":0,"inserted":0,"replaced":1,"skipped":0,"unchanged":0}]}
Now there is a Changes
key to parse and populate Result.Changes
. I think this is the expected behavior? Do you think there's a better way to handle this?
from rethinkdb.driver.
Okay, great! Glad you found the problem :) 👍
from rethinkdb.driver.
I obviously didn't need the changes, but just an indication that something changed! Thanks for the write up 😄
from rethinkdb.driver.
Related Issues (20)
- Create a method to return result as raw json HOT 4
- Resolution function on OptArg insert conflict HOT 1
- ConnectionPool.Builder.ConnectAsync does not respect InitialTimeout() HOT 4
- Add Error codes to Exceptions HOT 2
- Additional exceptions thrown when trying to cancel Cursor.MoveNextAsync() HOT 6
- Object's primary key and key of RunAtom() is different (Client-side generation). HOT 4
- Support for System.Text.Json.JsonDocument
- Cursor<T> should implement IAsyncEnumerable<T> in .net core 3
- RethinkDB 2.4 Release
- Best options: RunResult, RunAtom or RunCursor HOT 3
- Get list from Table that contains 'A' in the 'message' field HOT 1
- ASL 2.0 HOT 1
- Implement lambda functions as a possible argument in Insert().OptArgs("conflict",...) HOT 1
- System.NullReferenceException HOT 1
- Add EntityFramework support to Linq provider HOT 5
- Polymorphism HOT 1
- Various exceptions when updating a document HOT 1
- System.Configuration.ConfigurationErrorsException: HOT 1
- Wrong OptArg serialisation after OrderBy
- Insert not working with RunNoReply & Can't use runOpts is always null -- solved
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rethinkdb.driver.