Thanks Kristina.
I dont want to use Math::BigInt because we are trying to avoid too
many modules imported in to the script because of some performance
issue. We probably store it as a string or try to convert to Mongo's
MongoDB::BSON::Long.
One more thing I noticed...
When I store a number (from 32bit client to 64 bit server) say {a =>
2} mongo shell display as "a" : 2. But when I do the same in (64bit
client to 64bit server) mongo shell displays as "a" : NumberLong(2).
Any idea why? or is this just a javascript display issue?
On Oct 28, 1:54 am, Kristina Chodorow <
k.chodo...@gmail.com> wrote:
> You have to store it as a 64-bit int (NumberLong), it doesn't fit in
> 32 bits. To force it to be stored as a 64-bit int, you can use bigint
> or the Math::BigInt class (seehttp://
search.cpan.org/dist/MongoDB/lib/MongoDB/DataTypes.pod#Numbers).
> Try to avoid using $where, NumberLongs will compare correctly doing
> queries like {num => 123} (instead of {'$where' => 'this.num ==
> 123'}).
>
> On Oct 25, 7:35 pm, Manoj <
mano...@gmail.com> wrote:
>
>
>
>
>
>
>
> > The value I can see through the mongo shell is -1761607475.
> > What you mean by force the type as log? how can I do it in such a way
> > that it wont force 2 digit number as long.
> > If you are talking about "NumberLong()" then I dont want that, becausehttp://
groups.google.com/group/mongodb-user/browse_thread/thread/d645...
>
> > On Oct 26, 10:22 am, Riyad <
rka...@gmail.com> wrote:
>
> > > Manoj,
>
> > > Does it happen to bestoringit as -385876174 or roughly there abouts? If
> > > so it looks like it is treating that 2nd number as a 32-bit int (max value
> > > of 2,147,483,647) where as it is correctly treating the 2nd number as a
> > > 64-bit long (And thusstoringit correctly).