flybass / luamongo

Automatically exported from code.google.com/p/luamongo
0 stars 0 forks source link

numeric looking string keys confused on storing #12

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require 'mongo'
> db  = assert(mongo.Connection.New())
> assert(db:connect('localhost:7777'))
> xx = {}
> xx["0668936222882698"] = true
> xx["4118817c3fae8cd0"] = true
> for k,v in pairs(xx) do
>> print(type(k),k,v)
>> end
string  0668936222882698        true
string  4118817c3fae8cd0        true
> assert(db:insert('test.xxx',xx))
> x= assert(db:query('test.xxx',{}))
> yy = (x:results())()
> for k,v in pairs(yy) do
>> print(type(k),k,v)
>> end
string  6.68936e+14     true                  <<<<< WRONG
string  4118817c3fae8cd0        true
string  _id     4e046a52aec81887caefbb45

After doing a similar insert from python
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require 'mongo'
> db  = assert(mongo.Connection.New())
> assert(db:connect('localhost:7777'))
> x= assert(db:query('test.yyy',{}))
> yy = (x:results())()
> for k,v in pairs(yy) do
>> print(type(k),k,v)
>> end
string  0668936222882698        999
string  _id     4e046d1db373d57634000000

AFAICT the code is still at the same revision level as when I downloaded it.

Original issue reported on code.google.com by E.Co...@ed.ac.uk on 24 Jun 2011 at 11:34

GoogleCodeExporter commented 8 years ago
Oh yeah, forgot:

Red Hat Enterprise Linux Server release 5.6 (Tikanga)

It's a 32 bit system, I know that's not ideal for mongo but has to do for now.

Original comment by E.Co...@ed.ac.uk on 24 Jun 2011 at 3:06

GoogleCodeExporter commented 8 years ago
I have pushed a fix to this bug on github:
https://github.com/neomantra/luamongo/commit/04dabd6d8bd166041b284f36b4b13d02f1c
b2aab

Original comment by neoman...@gmail.com on 30 Jul 2011 at 8:05