且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MongoDB:getLastError()返回什么

更新时间:2023-02-16 21:22:49

getLastError()命令正在执行正确的操作.告诉您操作已成功(ok:1.0),并且未发生任何错误("err":null).

The getLastError() command is doing the correct thing. It's telling you that the action was successful (ok:1.0) and that no error occurred ("err":null).

有关更多详细信息,请查看最近更新的文档.

For more details check out the recently updated docs.

getLastError()还有一些与日记和复制相关的功能,您可能需要调查.

getLastError() also has some functionality related to journaling and replication that you may want to investigate.

针对第一条评论:

...
  if(del.getLastError().ok != 1.0){    
     logger.error("ERROR");  
  }   

} catch (Exception e) {
  logger.error("ERROR" );
}