Thursday, January 25, 2018

mongodb - Read csv value as boolean with php

I have a problem with the way php saves data in mongoDB.

I have a .csv file in which I have a field that has to be boolean, so I put 'false' for it.
When I read it with php from .csv, the value is a 'string', which is interpreted by mongoDB as an NOT-empty string, which results in a 'true' value field.
Is there a way to read it like a boolean value?



I found an answer that will partially solve my problem (How to convert string to boolean php), but I want to avoid that part and read it like bool, or at least save it like a bool in mongoDB with the values 'false' => false, and not 'false' => true

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...