我想引导以下课程:
import org.bson.types.ObjectId
class Foo{
ObjectId id
String name
}
现在在 BootStrap.groovy 我放了:
import org.bson.types.ObjectId
...
def foo = new Foo(
id: new ObjectId("507f191e810c19729de860ea"),
name: "foo"
)
但是当我想检查脚手架结果时,我收到以下错误:
Error 500: Internal Server Error
Class
java.lang.IllegalStateException
Message
Cannot convert value of type [java.lang.Integer] to required type [org.bson.types.ObjectId] for property 'id': no matching editors or conversion strategy found
我怎样才能显示ObjectId
?