title: Iterate on req.body.objectName to test whether the key-value pairs are valid or not in node js
body: <p>the problem statement is something like this :
  <strong>"the node js webservice server application should first validate whether the req.body.object contains valid key-value pairs, if its present then only go to mongodb specific method and do some CRUD operation and send response otherwise send response as key-value pairs are not correct or something similar."</strong></p>
  
  <p>So, for achieving this, I tried putting things like the below one at the route: </p>
  
  <pre><code>if ((updatevalues.ConfigID == null) || (updatevalues.ConfigName == null) || (updatevalues.Description == null) || (updatevalues.Version == null) || (updatevalues.ClassName == null) || (updatevalues.ConfigGroups_Info.AllEvents == null) || (updatevalues.ConfigGroups_Info.BillingDateCleard == null) || (updatevalues.ConfigGroups_Info.BillingScheduleExpiration == null) || (updatevalues.ConfigGroups_Info.ConfigurationErrorDetected == null) || (updatevalues.ConfigGroups_Info.DailySelfReadTime == null) || (updatevalues.ConfigGroups_Info.DataVineHyperSproutChange == null) || (updatevalues.ConfigGroups_Info.DataVineSyncFatherChange == null) || (updatevalues.ConfigGroups_Info.Demand == null) || (updatevalues.ConfigGroups_Info.DemandResetOccured == null) || (updatevalues.ConfigGroups_Info.DeregistrationResult == null) || (updatevalues.ConfigGroups_Info.EnableVoltageMonitor == null) || (updatevalues.ConfigGroups_Info.Energy1 == null) || (updatevalues.ConfigGroups_Info.HighVoltageThresholdDeviation == null) || (updatevalues.ConfigGroups_Info.HistoryLogCleared == null) || (updatevalues.ConfigGroups_Info.InterrogationSendSucceeded == null) || (updatevalues.ConfigGroups_Info.IntervalLength == null) || (updatevalues.ConfigGroups_Info.LinkFailure == null) || (updatevalues.ConfigGroups_Info.LinkMetric == null) || (updatevalues.ConfigGroups_Info.LoadProfileError == null) || (updatevalues.ConfigGroups_Info.LowBatteryDetected == null) || (updatevalues.ConfigGroups_Info.LowVoltageThreshold == null) || (updatevalues.ConfigGroups_Info.LowVoltageThresholdDeviation == null) || (updatevalues.ConfigGroups_Info.OutageLength == null) || (updatevalues.ConfigGroups_Info.PrimaryPowerDown == null) || (updatevalues.ConfigGroups_Info.PulseWeight1 == null) || (updatevalues.ConfigGroups_Info.PulseWeight2 == null) || (updatevalues.ConfigGroups_Info.PulseWeight3 == null) || (updatevalues.ConfigGroups_Info.PulseWeight4 == null) || (updatevalues.ConfigGroups_Info.Quantity4 == null) || (updatevalues.ConfigGroups_Info.RMSVoltHighThreshold == null) || (updatevalues.ConfigGroups_Info.RMSVoltLoadThreshold == null) || (updatevalues.ConfigGroups_Info.ReceivedMessageFrom == null) || (updatevalues.ConfigGroups_Info.SendResponseFailed == null) || (updatevalues.ConfigGroups_Info.TableSendRequestFailed == null) || (updatevalues.ConfigGroups_Info.TestModeDemandIntervalLength == null) || (updatevalues.ConfigGroups_Info.TimetoremaininTestMode == null) || (updatevalues.ConfigGroups_Info.ZigbeeSETunnelingMessage == null) || (updatevalues.ConfigGroups_Info.ZigbeeSimpleMeteringMessage == null)) {
  
      res.json({
          "type": false,
          "Status": "Invalid Parameter"
      });
  }
  else {
  
      dbCmd.updateConfigDataValues(updatevalues, function (err, data) {
          if (err) {
              res.json({
                  "type": false,
                  "Message": err.message,
              });
          } else {
              res.json({
                  "type": true,
                  "Message": data.toString(),
              });
          }
      });
  }
  </code></pre>
  
  <p>});</p>
  
  <pre><code>module.exports = router;
  </code></pre>
  
  <p>What I feel is this is not the right or optimized way to achieving the above said objective. <strong>I want to compact/compress the If condition so that code could look better</strong>. 
  kindly help.</p>