perl - How do you query for, or insert as, specific types in MongoDB? -


i'm using perl bindings mongodb, , seems when insert numbers, counted strings. when add 0 number, gets converted.

is there way, mongodb perl bindings, specify data type on insertion?

is there way query specific types?

an example type query might this, if there "$type" function:

db.c.find({ key: { '$type': 'numberlong' } }); 

mongodb contain $type operator checking against bson datatype: http://www.mongodb.org/display/docs/advanced+queries#advancedqueries-%24type

unfortunately in perl subject languages semantics ... there no number datatype in perl scalar.

if perl has decided store value string how go bson , $type not match correctly.

however perl driver attempts to.test if perl can treat string saving number in case.it.is.stored such; may want test along $test operator.


Comments