SCALA LIFT - 模型错误地保存在 mongo 集合中
我有以下模型:
class Mix private() extends MongoRecord[Mix] with ObjectIdPk[Mix] {
def meta = Mix
object title extends StringField(this, 50)
object description extends StringField(this, 500)
object link extends StringField(this, 250)
object date extends DateField(this)
}
object Mix extends Mix with MongoMetaRecord[Mix]
每当我尝试保存一条记录时,它不会保存在“Mixes”集合中,而是创建一个名为“Mixs”的新记录并填充该记录。
我是否应该定义一些东西来告诉它使用正确命名的“Mixes”集合?
这似乎是“mix”一词的不正确复数形式,但我不确定如何纠正它。
预先感谢您的任何帮助。
I have the following model:
class Mix private() extends MongoRecord[Mix] with ObjectIdPk[Mix] {
def meta = Mix
object title extends StringField(this, 50)
object description extends StringField(this, 500)
object link extends StringField(this, 250)
object date extends DateField(this)
}
object Mix extends Mix with MongoMetaRecord[Mix]
Whenever I try and save a record, instead of saving in the collection "Mixes", it creates a new one called "Mixs" and populates that instead.
Is there something I should be defining to tell it to use the correctly named "Mixes" collection?
This seems to be an incorrect pluralization of the word mix, but am unsure how to correct it.
Thanks in advance for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MongoRecord 只是在对象名称中添加一个“s”,并且不知道其他复数规则。为了解决这个问题,您需要
在
object Mix
中进行重写。MongoRecord simply adds an ‘s’ to your Object’s name and doesn’t know anything about other pluralisation rules. In order to fix this, you need to override
in
object Mix
.