eclipse - token “default”语法错误,预期为StringLiteral

标签 eclipse mongoose syntax-error default

我正在Eclipse IDE上使用Mongo-Mongoose,并且正在尝试为模式创建默认值,如示例中所示:

myNum: { type: Number, default: 1 },
myDate: { type: Date, default: Date.now },

但似乎默认是一个已保存的单词,因此我得到:

Syntax error on token "default", StringLiteral expected



我猜这是由Eclipse产生的错误-如何绕过它?

最佳答案

将“”中的“默认”字词括起来即可解决:

myNum: { type: Number, 'default': 1 },
myDate: { type: Date, 'default': Date.now },

关于eclipse - token “default”语法错误,预期为StringLiteral,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24504534/

相关文章:

java - JDEE 值得使用吗?

java - Ecore 建模项目不可用

node.js - Mongoose - 单例模型

node.js - Mongoose 聚合 "$sum"子文档中的行

python - 为什么 Maya 2009 TreeView 控件在拖动时出现语法错误?

sql - 请提供简单的SQL Server语法帮助

java - Eclipse 保持使用 bin/META-INF/persistence.xml

java - 将 libgdx 项目导入 Eclipse 时未绑定(bind)类路径变量 junit 和 log4j

node.js - 为什么不能修改 Mongoose 查询返回的数据(例如 : findById)

batch-file - 为什么我会收到此错误? - "The syntax of the command is incorrect."