N1QL query - SELECT and DELETE

n1ql

#1

I would like to select list of all documents where firstName = null and I would like to delete them as well. Please help me both select N1QL query to execute it from couchabse workbench console

[
  {
    "api": {
      "timeStamp": 1524601824725,
      "trackingId": "unknownUser",
      "type": "customer",
      "uuid": "267523c216dc47108b71b19c695552d1",
      "data": {
        "emailAddress": "ASE_4A8DF6E42C32EF7502325415FD862EEABAE207B0D3C8741D",
        "title": "Captain",
        "firstName": "null"
      }
    }
  },
  {
    "api": {
      "timeStamp": 1524601824725,
      "trackingId": "unknownUser",
      "type": "customer",
      "uuid": "267523c216dc47108b71b19c695552d1",
      "data": {
        "emailAddress": "ASE_4A8DF6E42C32EF7502325415FD862EEABAE207B0D3C8741D",
        "title": "Captain",
        "firstName": "null"
      }
    }
  }
]

#2

I was able to find the answer from one of the examples form the forum. it works for me from the below queries

SELECT * FROM api AS d WHERE d.type = “customer” and d.data.firstName=“null”
DELETE FROM api AS d WHERE d.type = “customer” and d.data.firstName=“null”