1

First up, I want to apologise for the somewhat ambiguous question title, but I have literally no idea how else to describe this bizarre issue. Effectively, I have a document store inside of RavenDB, and despite trying to change it, there seems to be weird constraints that cause it to randomly round it to different values.

This is best shown through this gif I made of it: Constantly Being Rounded?

Within the C# class that this is being created from, it's being stored as a ulong, and everything is right within the code until it's being loaded. At which point I have an ID mismatch. As you can see, the document name is the ID I am trying to paste in, they are meant to match; but I am being hit with this very weird glitch instead.

Does anyone have an idea?

4

1 回答 1

2

The underlying issue lies with JavaScript numbers. All JS numbers are actually double, which means that they are good for integer numbers up until 2^53 or so. Beyond that, you start to lose precision.

What is actually happening here is that the browser is loading the document and saving it back. This goes through the JS engine, which cause lose of precision of the number. The problem occurs only if you are updating the documents through the studio.

In the latest version of RavenDB, this will be detected and you'll get a warning:

Number too large warning

于 2019-04-19T05:30:07.980 回答