Skip to content

Conversation

@hustfyb
Copy link

@hustfyb hustfyb commented Mar 27, 2014

No description provided.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use forEach

@1602
Copy link
Contributor

1602 commented Mar 27, 2014

And couple more questions: what if one of updates failed? how to handle error?

@hustfyb
Copy link
Author

hustfyb commented Apr 2, 2014

I know the questions.To fix it should use event but it will import mass code. And I found another issue.
Part code

schema.models.push.create({pushId:"111111111111111111"},function(err,user){
    console.log(user);
    schema.models.push.all({},function(err,data){
        console.log(data);
    })
})

The all function will return 111111111111111100 not 111111111111111111.
It seems redis client change String to Number automaticly. I had checked redis, it's right.
Do you know the reason

@anatoliychakkaev
Copy link

How did you checked redis? For me it works as expected:

redis 127.0.0.1:6379> hmget a a

  1. (nil)
    redis 127.0.0.1:6379> hmset a 111111111111111111
    (error) ERR wrong number of arguments for 'hmset' command
    redis 127.0.0.1:6379> hmset a a 111111111111111111
    OK
    redis 127.0.0.1:6379> hmget a a
  2. "111111111111111111"
    redis 127.0.0.1:6379> hgetall a
  3. "a"
  4. "111111111111111111"

On 2 April 2014 08:13, hustfyb notifications@github.com wrote:

I know the questions.To fix it should use event but it will import mass
code. And I found another issue.
Part code

schema.models.push.create({pushId:"111111111111111111"},function(err,user){
console.log(user);
schema.models.push.all({},function(err,data){
console.log(data);
})})

The all function will return 111111111111111100 not 111111111111111111.
It seems redis client change String to Number automaticly. I had checked
redis, it's right.
Do you know the reason

Reply to this email directly or view it on GitHubhttps://github.com//pull/9#issuecomment-39295113
.

@hustfyb
Copy link
Author

hustfyb commented Apr 2, 2014

I found the reason. In BridgeToRedis.prototype.fromDb function you will convert string type to JSON object. That will change a number string to a real number, than js will lose precision. You should not touch the string type.

1 similar comment
@hustfyb
Copy link
Author

hustfyb commented Apr 2, 2014

I found the reason. In BridgeToRedis.prototype.fromDb function you will convert string type to JSON object. That will change a number string to a real number, than js will lose precision. You should not touch the string type.

@hustfyb
Copy link
Author

hustfyb commented Apr 2, 2014

Apologize for my pool English.

@hustfyb
Copy link
Author

hustfyb commented Apr 2, 2014

My error. I don't know when I delele some code, I didn't notice that, Sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants