Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-6842

long values greater than 2^53 need to be stored as string

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Component/s: None
    • Security Level: Public
    No reviews matched the request. Check your Options in the drop-down menu of this sections header.

      Activity

      Hide
      farshid Farshid Ghods (Inactive) added a comment - - edited

      erver: Windows 2008 R2 64 bit
      Client: C#
      Confirmed Json string being written with .Save and the long value is correct during the save function.
      In read function and also the Admin UI the value of the long field is incorrect. Here is an example:
      Document: fbUser_634851623223408516

      { "CreatedTime": "/Date(1349565522340-0700)/", "TableExpires": "/Date(-62135568000000-0800)/", "UserId": 634851623223408500, "UserName": "634851623223408516", "UserPin": "888", "recType": "fbUser" }

      UserId should be same as UserName as was confirmed during the .Save function.
      Any ideas why the long
      [DataMember]
      [JsonProperty(PropertyName = "UserId")]
      public long UserId

      { get; set; }
      Show
      farshid Farshid Ghods (Inactive) added a comment - - edited erver: Windows 2008 R2 64 bit Client: C# Confirmed Json string being written with .Save and the long value is correct during the save function. In read function and also the Admin UI the value of the long field is incorrect. Here is an example: Document: fbUser_634851623223408516 { "CreatedTime": "/Date(1349565522340-0700)/", "TableExpires": "/Date(-62135568000000-0800)/", "UserId": 634851623223408500, "UserName": "634851623223408516", "UserPin": "888", "recType": "fbUser" } UserId should be same as UserName as was confirmed during the .Save function. Any ideas why the long [DataMember] [JsonProperty(PropertyName = "UserId")] public long UserId { get; set; }
      Hide
      ezrover Nader Rahimizad added a comment -

      You can simply see this bug by entering 634851623223408516 into the UserId field on the AdminUI and you will see it round up when you click save!

      Show
      ezrover Nader Rahimizad added a comment - You can simply see this bug by entering 634851623223408516 into the UserId field on the AdminUI and you will see it round up when you click save!
      Hide
      farshid Farshid Ghods (Inactive) added a comment -

      Filipe,

      should QE reproduce this and append diags or you are already aware of this limitation for a value great than pow(2,59) which is the value posted by the user.

      not sure whethere we store this as long or integer ?

      Show
      farshid Farshid Ghods (Inactive) added a comment - Filipe, should QE reproduce this and append diags or you are already aware of this limitation for a value great than pow(2,59) which is the value posted by the user. not sure whethere we store this as long or integer ?
      Hide
      FilipeManana Filipe Manana (Inactive) added a comment -

      You're hitting a limit of most (if not all) JavaScript engines. They can't represent number larger than 2 ** 53.
      See the following in node (V8) and Spidermonkey:

      fdmanana 23:43:24 ~ > node
      > 634851623223408516
      634851623223408500
      > fdmanana 23:43:36 ~ >
      fdmanana 23:43:37 ~ > js
      > 634851623223408516
      634851623223408500
      > fdmanana 23:43:41 ~ >
      fdmanana 23:43:42 ~ >

      Anyone who wants to store such large numbers, will have to store them as strings.

      Show
      FilipeManana Filipe Manana (Inactive) added a comment - You're hitting a limit of most (if not all) JavaScript engines. They can't represent number larger than 2 ** 53. See the following in node (V8) and Spidermonkey: fdmanana 23:43:24 ~ > node > 634851623223408516 634851623223408500 > fdmanana 23:43:36 ~ > fdmanana 23:43:37 ~ > js > 634851623223408516 634851623223408500 > fdmanana 23:43:41 ~ > fdmanana 23:43:42 ~ > Anyone who wants to store such large numbers, will have to store them as strings.
      Hide
      FilipeManana Filipe Manana (Inactive) added a comment -

      Nothing we can do about this.

      Show
      FilipeManana Filipe Manana (Inactive) added a comment - Nothing we can do about this.
      Hide
      farshid Farshid Ghods (Inactive) added a comment -

      reopening the ticket and assigning this to MC for documentation

      Show
      farshid Farshid Ghods (Inactive) added a comment - reopening the ticket and assigning this to MC for documentation
      Hide
      FilipeManana Filipe Manana (Inactive) added a comment -

      Actually, even ECMA spec mentions it: http://ecma262-5.com/ELS5_HTML.htm#Section_8.5

      Show
      FilipeManana Filipe Manana (Inactive) added a comment - Actually, even ECMA spec mentions it: http://ecma262-5.com/ELS5_HTML.htm#Section_8.5
      Hide
      ezrover Nader Rahimizad added a comment -

      You will also need to document this in your .Net sdk as this is a C# long...

      I converted my app to strings instead of longs to overcome this shortcoming. Thanks

      Show
      ezrover Nader Rahimizad added a comment - You will also need to document this in your .Net sdk as this is a C# long... I converted my app to strings instead of longs to overcome this shortcoming. Thanks
      Hide
      mccouch MC Brown (Inactive) added a comment -

      Documentation has been updated in the .NET and Couchbase Server manuals. I'll replicate to the other SDKs later today.

      Show
      mccouch MC Brown (Inactive) added a comment - Documentation has been updated in the .NET and Couchbase Server manuals. I'll replicate to the other SDKs later today.

        People

        • Assignee:
          mccouch MC Brown (Inactive)
          Reporter:
          mikew Mike Wiederhold
        • Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved:

            Gerrit Reviews

            There are no open Gerrit changes