Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/mercurial/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon dynamodb Vogels DynamoDB迁移到较新api时出错_Amazon Dynamodb_Vogels - Fatal编程技术网

Amazon dynamodb Vogels DynamoDB迁移到较新api时出错

Amazon dynamodb Vogels DynamoDB迁移到较新api时出错,amazon-dynamodb,vogels,Amazon Dynamodb,Vogels,我正在使用Vogels DynamoDB data mapper for node.js,在DynamoDB(在AWS上)中工作一直非常困难。对于DynamoDB local,没有任何问题-它设置了模式并在node.js应用程序中完美工作 但是,部署到AWS时-出现以下错误: Details:Error: define no longer accepts schema callback, migrate to new api 我使用的是最新版本的Vogels() 那么为什么要迁移到一个新的ap

我正在使用Vogels DynamoDB data mapper for node.js,在DynamoDB(在AWS上)中工作一直非常困难。对于DynamoDB local,没有任何问题-它设置了模式并在node.js应用程序中完美工作

但是,部署到AWS时-出现以下错误:

Details:Error: define no longer accepts schema callback, migrate to new api
我使用的是最新版本的Vogels()


那么为什么要迁移到一个新的api呢

在Vogels 2.0中删除了
定义
中的
回调

define
中的第二个参数现在是schema。如果您将函数作为第二个参数传递,则会出现此错误,因为Vogel认为您正在尝试使用Vogels 1.x:

if(_.isFunction(config)) {
  throw new Error('define no longer accepts schema callback, migrate to new api');
}
资料来源:

因此,请检查
define
调用中的第二个参数。这应该是JSON格式的模式,而不是函数。官方文件中的一个示例:

var Account = vogels.define('Account', {
  hashKey : 'email',

  // add the timestamp attributes (updatedAt, createdAt)
  timestamps : true,

  schema : {
    email   : Joi.string().email(),
    name    : Joi.string(),
    age     : Joi.number(),
    roles   : vogels.types.stringSet(),
    settings : {
      nickname      : Joi.string(),
      acceptedTerms : Joi.boolean().default(false)
    }
  }
});