Simple "IF" in map when creating a view - I'm missing something simple

Hello,

I’m trying to create a very simple view, but it fails to return results when I add my “IF” statement. I have different types of documents and I want to look for only docs with a specific node or where the id starts with a string. The Reduce is just “_count”. The “Map” and sample document are below.

Map
function(doc, meta) {
if (doc.metricType == “No_License”) {
emit([doc.ownedByCustomerNumber, doc.soldProduct.category], meta.id);
}
}

I would actually prefer ’ if (meta.id.startsWith(“Turnaway:”) ', but I’m just trying to get anything to work.
Sample Document

{
      "OvidUserId": 62206684,
      "id": "Turnaway:00003086:10784014",
      "ipAddress": "206210161066",
      "journalTurnawayNumber": 10784014,
      "metricType": "Limit_Exceeded",
      "oaCode": "Controlled",
      "orderNumber": 1160430,
      "ovidGroupID": 1768594,
      "ovidGroupName": "wmmc999",
      "ovidUserName": "wmmc999",
      "ownedByCustomerNumber": 8094,
      "platform": "Lippincott",
      "samlString": "",
      "serialName": "00003086",
      "sessionID": "0dea967d-a03f-4b8d-8128-10bb690c10a5",
      "soldProduct": {
        "category": "Orthopedics",
        "name": "Clinical Orthopaedics and Related Research",
        "productCode": "CORRJN18",
        "productNumber": 30548,
        "subCategory": "",
        "subject": "Clinical Medicine"
      },
      "soldToCustomer": {
        "customerNumber": 8094,
        "keyAccount": false,
        "name": "White Memorial Medical Center"
      },
      "turnawayDateTime": "2022-05-13T23:48:37.771",
      "usedByCustomer": {
        "customerNumber": 8094,
        "keyAccount": false,
        "name": "White Memorial Medical Center"
      },
      "usedByCustomerNumber": 8094,
      "yearMonth": "202205"
    },
    "id": "Turnaway:00003086:10784014"
  }

Thank You,
Gerry

Hi!
Which version are you running? We highly recommend users to not use views anymore.