samples/sample-sync-doc-definitions.js
function validateBusinessIdProperty(doc, oldDoc, currentItemEntry, validationItemStack) {
    var parentObjectElement = validationItemStack[validationItemStack.length - 1];

    var businessId = currentItemEntry.itemValue;
    var oldBusinessId = currentItemEntry.oldItemValue;

    var validationErrors = [ ];

    if (parentObjectElement.oldItemValue && oldBusinessId !== businessId) {
      validationErrors.push('cannot change "businessId" property');
    }

    return validationErrors;
  }
function validateBusinessIdProperty(doc, oldDoc, currentItemEntry, validationItemStack) {
    var parentObjectElement = validationItemStack[validationItemStack.length - 1];

    var businessId = currentItemEntry.itemValue;
    var oldBusinessId = currentItemEntry.oldItemValue;

    var validationErrors = [ ];

    if (parentObjectElement.oldItemValue && oldBusinessId !== businessId) {
      validationErrors.push('cannot change "businessId" property');
    }

    return validationErrors;
  }
Checks that a business ID is valid (an integer greater than 0) and is not changed from the old version of the document