cakephp-mongodb icon indicating copy to clipboard operation
cakephp-mongodb copied to clipboard

strict type juggling proposal

Open aaronpeterson opened this issue 12 years ago • 2 comments

It seems like Model's typing is not sufficiently strict enough for a doc db? It appears to only cast date/time types. See my tests...if my schema the field "count" defined as in integer I only want it stored in mongo as an integer. Not a string.

aaronpeterson avatar Oct 22 '11 19:10 aaronpeterson

If you are using mongo - you have to take responsibility for ensuring things are the right type on insert. see my comment here: https://github.com/ichikaway/cakephp-mongodb/issues/35#issuecomment-3427909

AD7six avatar Jan 10 '12 10:01 AD7six

Incidentally,

In my own projects I would simply pass form data through a function to recurse on all values and cast int/floats as it found them. Relying on model schema to do it for you will mean any array/objects saved in your data will not have their values cast.

AD7six avatar Jan 11 '12 09:01 AD7six