N1QL output format Question

The check returns true or false and you can’t use that in concat which requires string. When unit is MISSING,NULL , “” you will have two spaces. If you don’t want that use CASE expression to control that.

CONCAT(mailing_address.address, " ", 
                      IFMISSINGORNULL(mailing_address.unit,""), " ",
                      mailing_address.city, " ",
                      mailing_address.zip) AS mailingAddress