On Wed, 2 May 2012, KingCanadian wrote:
> i have a very large number in mongodb saved as a string because my php
> is 32bit and int is not big enough.
I would strongly suggest to use a 64 bit build of PHP if you'd like
this. Also please read
http://derickrethans.nl/64bit-ints-in-mongodb.html
> I tried:
> array (
> 'scan_tsp' => array($lt => 20120502101406)
> )
You need to use single quotes around operators.
array (
'scan_tsp' => array('$lt' => 20120502101406)
)
> But it does not work - message: For your security, we stoped data
> parsing at '(T_VARIABLE) $lt'.
That is interesting, I've never seen that error before... it's AFAIK not
part of a normal PHP installation.
> Is there any way to do a < or > with this string?
Yes, '$lt' and '$gt' will work with strings, but you need to make sure
to compare against a string then, and your example still shows you're
passing in an integer. Your code should be:
array (
'scan_tsp' => array('$lt' => '20120502101406')
)
cheers,
Derick
--
http://mongodb.org |
http://derickrethans.nl
twitter: @derickr and @mongodb