Closed JoeStead closed 8 years ago
I believe the problem here is the 'UpdateObject(o)' method call. This can't be executed client-side because 'o' is a reference to a server-side object, and it can't be converted into a server-side expression because the drive can't convert arbitrary functions.
Just to clarify, I believe a working version of the JS query you've provided would be:
_dbConnection.Run(_table.Get(_currentKey).Update(o => new WhateverType { hits = o.hits + 1 })```
This is similar to the code in (https://github.com/mfenniak/rethinkdb-net/blob/5853690123ff54f70beb014d7c72fbea515b0d1e/rethinkdb-net-test/Integration/SingleObjectTests.cs#L107), or (https://github.com/mfenniak/rethinkdb-net/blob/5853690123ff54f70beb014d7c72fbea515b0d1e/rethinkdb-net-test/Integration/RealtimePushTests.cs#L185), which are part of the driver unit tests so they pretty definitely work.
Yeah, that makes loads of sense. I had a "ugh what" day I think. Thanks for clearing it up :)
When chaining together a GetQuery and UpdateQuery, some horrible expression-based exception is thrown:
The C# that throws this exception is:
Which is based on the REQL:
Found on the consistency page of the documentation.
It could be by understanding of the query is misplaced and this makes no sense, but it seems a bit suspect that you can't update specific records without first using the Filter method (which makes the operation non-atomic).