Thursday, 25 January 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

casting - Why wasn't Tobey Maguire in The Amazing Spider-Man? - Movies & TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...