title: on dynamoose update ValidationException: The number of conditions on the keys is invalid
body: <p>good afternoon</p>
  
  <p>dynamoose modal update throwing an error of ValidationException: The number of conditions on the keys is invalid. i am tried debbuging here is the debug result from export DEBUG=dynamoose*</p>
  
  <pre><code>dynamoose:model Update {"key":"1","email":"biraj@gmail.com"} +24s
    dynamoose:attribute toDynamo {"S":"1"} +24s
    dynamoose:attribute toDynamo {"N":"1550997177674"} +2ms
    dynamoose:attribute toDynamo {"N":"1550997177674"} +2ms
    dynamoose:table Waiting for Active table, Chat, {"update":true,"create":true,"waitForActive":true,"waitForActiveTimeout":180000,"prefix":"","suffix":""} +24s
    dynamoose:table Waiting... +4ms
    dynamoose:table index idGlobalIndex.IndexStatus is ACTIVE +22ms
    dynamoose:model updateItem { TableName: 'Chat',
    Key: { key: { S: '1' }, initiate_time: null },
    ExpressionAttributeNames: { '#_n0': 'update_time' },
    ExpressionAttributeValues: { ':_p0': { N: '1550997177674' } },
    ReturnValues: 'ALL_NEW',
    UpdateExpression: 'SET #_n0 = :_p0 ' } +34ms 
  </code></pre>
  
  <p>and here is the returned error with the execution :</p>
  
  <pre><code>dynamoose:model Error returned by updateItem { ValidationException: The number of conditions on the keys is invalid
      at Request.extractError (/home/vagrant/api/node_modules/aws-sdk/lib/protocol/json.js:51:27)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at callNextListener (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
      at IncomingMessage.onEnd (/home/vagrant/api/node_modules/aws-sdk/lib/event_listeners.js:299:13)
      at IncomingMessage.emit (events.js:193:15)
      at IncomingMessage.EventEmitter.emit (domain.js:441:20)
      at endReadableNT (_stream_readable.js:1129:12)
      at process.internalTickCallback (internal/process/next_tick.js:72:19)
    message: 'The number of conditions on the keys is invalid',
    code: 'ValidationException',
    time: 2019-02-25T08:32:57.732Z,
    requestId: '0bc7c973-6912-40f1-a270-ecbc13551e20',
    statusCode: 400,
    retryable: false,
    retryDelay: 5.042568165458738 } +26ms
  { ValidationException: The number of conditions on the keys is invalid
      at Request.extractError (/home/vagrant/api/node_modules/aws-sdk/lib/protocol/json.js:51:27)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
      at Request.emit (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:683:14)
      at Request.transition (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:22:10)
      at AcceptorStateMachine.runTo (/home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:14:12)
      at /home/vagrant/api/node_modules/aws-sdk/lib/state_machine.js:26:10
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:38:9)
      at Request.&lt;anonymous&gt; (/home/vagrant/api/node_modules/aws-sdk/lib/request.js:685:12)
      at Request.callListeners (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
      at callNextListener (/home/vagrant/api/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
      at IncomingMessage.onEnd (/home/vagrant/api/node_modules/aws-sdk/lib/event_listeners.js:299:13)
      at IncomingMessage.emit (events.js:193:15)
      at IncomingMessage.EventEmitter.emit (domain.js:441:20)
      at endReadableNT (_stream_readable.js:1129:12)
      at process.internalTickCallback (internal/process/next_tick.js:72:19)
    message: 'The number of conditions on the keys is invalid',
    code: 'ValidationException',
    time: 2019-02-25T08:32:57.732Z,
    requestId: '0bc7c973-6912-40f1-a270-ecbc13551e20',
    statusCode: 400,
    retryable: false,
    retryDelay: 5.042568165458738 }
  </code></pre>
  
  <p>here is the chat modalin which the operation is being done:</p>
  
  <pre><code>var dynamoose = require('dynamoose');
  
  var ChatSchema = new dynamoose.Schema({
    id:{
      type: String,
      index: {
        global:true
      }
    },
    key: {
      type: String,
      hashKey: true,
      default:"1"
    },
    category_id: {
      type: String
    },
    initiate_time: {
      type: Date,
      rangeKey: true
    },
    update_time: {
      type: Date,
      index: {
        global: false,
        name:"UpdateTimeSecondaryIndex"
      }
    },
    name: {
      type: String
    },
    email: {
      type: String,
      index: {
        global: false
      }
    },
    support_id: {
      type: String
    }
  
  });
  
  ChatSchema.method('getLanguages', async function () {
      var {ChatLang} = require("./index");
      var languages = await ChatLang.query({chatId: this.id}).exec();
      if (languages != null &amp;&amp; languages.length &gt; 0)
      {
        return languages;
      }
      return false;
  });
  
  
  module.exports = ChatSchema;
  </code></pre>
  
  <p>and here is the actual code for update:</p>
  
  <pre><code>try {
        await Chat.update({
          key: "1",
          email: args.chat.email
        }, {
            update_time: Moment().subtract(24, "hours"),
            initiate_time: Moment().subtract(24, "hours")
          });
      } catch (err) {
        console.log(err);
      }
  </code></pre>
  
  <p>any clues and help is appreciated thank you.</p>