RT
在命令行执行 是没问题的
db.user_push.update_time.find({"_id":"rekoe"})
{ "_id" : "rekoe", "time" : "2017-07-24 15:27:30" }
wcg:PRIMARY>
但用程序调用
public void fetch() {
ZMoCo zMoCo = zMoDB.c(VideoRate.CNAME);
ZMoDoc old = zMoCo.findOne(ZMoDoc.NEW("{\"_id\":\"rekoe\"}"));
System.out.println("~~~~~~~~~~~~"+old);
}
提示错误
2017-08-23 17:23:35,633 [DEBUG][org.mongodb.driver.protocol.query] - Query completed
Exception in thread "main" java.lang.RuntimeException: 'rekoe' not ObjectId
at org.nutz.lang.Lang.makeThrow(Lang.java:132)
at org.nutz.mongo.ZMoDoc.put(ZMoDoc.java:497)
at org.nutz.mongo.ZMoDoc.putAll(ZMoDoc.java:558)
at org.nutz.mongo.ZMoDoc.NEW(ZMoDoc.java:41)
at org.nutz.mongo.ZMoDoc.NEW(ZMoDoc.java:82)
at com.anawin.mongo.StudentService.fetch(StudentService.java:55)
at com.anawin.mongo.StudentTest.main(StudentTest.java:16)