queryReferenced() does not take false booleans

Hi everyone

My problem is that when I try to access my referenced collection it only returns the true booleans and not the false booleans.
This is the returned array:

Array(1)

0: 
"{\"_id\":\"c639f89b-715d-41be-a4ef-4bf7aef68c96\",\"_owner\":\"e80b8559-8e52-44a1-a9a6-bbb2e15d5e56\",\"_createdDate\":\"2020-09-12T07:52:42.351Z\",\"ma1230\":true,\"_updatedDate\":\"2020-09-12T08:09:51.335Z\",\"ma10\":true,\"title\":\"dddd\",\"ma9\":true}"

as you can see, only the true booleans are inside the array. not the false ones.

Here’s the total code:

$w.onReady( () => {

 let itemObj = $w("#dynamicDataset").getCurrentItem();
  wixData.queryReferenced("Kapperszaken", itemObj._id, "opHours")
    .then( (results) => {
 if(results.items.length > 0) {
        console.log(results.items)
 let firstItem = results.items[0]; //see item below
        $w("#text24").text = firstItem.title;
      } else {
        $w("#text24").text = "nothing found";
      }
    } )
    .catch( (err) => {
 let errorMsg = err;
      $w("#text24").text = "error";
    } );
});

How can I get the False values also inside the array?

Thanks
Jhon

Hi Jhon,

It will not return anything for fields that have not been assigned a value. What you could do is to check to see if it’s true by doing a test something like this that uses an example field called boolField . If it’s not true, then add it to the object in the array.

let itemObj = $w("#dynamicDataset").getCurrentItem();
wixData.queryReferenced("Kapperszaken", itemObj._id,"opHours")
  .then( (results) => {
    if(results.items.length > 0) {
       if (results.result.items[0].boolField){
           // do nothing
       } else {
           results.result.items[0].boolField = false;
      }
     }
    } );

Thanks! I managed it to work!