bchavez / bchavez/RethinkDb.Driver

Wrong OptArg serialisation after OrderBy

Open
#163 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
381
Forks
129
PR merge metrics
No merged PRs in 30d

Description

### Version Information
| .NET Full Framework? | 4.8 |
| RethinkDB Server | 2.3.6 |

Hi I have a very simple indexed orderby:
```
R.Db("db").Table("table").OrderBy().OptArg(R.Desc("lastName")).Limit(100)
```

This gives me:
```
RethinkDb.Driver.ReqlServerCompileError
Expected a TermType as a NUMBER but found STRING.
```
It produces this raw string:
```
$reql_reqlraw$[71,[[41,[[15,[[14,["db"]],"table"]]],{"index":["DESC",["lastName"]]}],100]]
```
Notice the "DESC" in the raw string? Should be 74. I believe OptArgs have a serialisation bug where they use globally defined JsonConvert.Settings accidentally and therefore the enum is serialised as string.

Any workarounds?

Contributor guide

Open the contributing guide

Research direction

Reproduce the indexed OrderBy query shown in the issue and inspect OptArg serialization, especially the global JsonConvert.Settings implicated by the report. Done when the generated raw ReQL uses numeric term type 74 instead of the string "DESC" and the query compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.