Java com.allanbank.mongodb.MongoCollection.insert的返回值的含义是什么(耐久性arg0,DocumentAssignable…arg1)

Java com.allanbank.mongodb.MongoCollection.insert的返回值的含义是什么(耐久性arg0,DocumentAssignable…arg1),java,mongodb,asynchronous,insert,driver,Java,Mongodb,Asynchronous,Insert,Driver,返回值 com.allanbank.mongodb.MongoCollection.insert(Durability arg0, DocumentAssignable... arg1) 是int 当我尝试打印返回值时,得到了0。该值已正确插入 问题:不清楚返回值0的含义。因此,我希望有人向我解释insert函数返回值的含义,因为文档不是很清楚 这个int值代表什么?这是 插入的文档数。如果耐久性为零,则此 值将为-1 因此,返回值0表示插入的文档数为0无。请详细说明这个问题?文档说明了什么

返回值

com.allanbank.mongodb.MongoCollection.insert(Durability arg0, DocumentAssignable... arg1) 
是int

当我尝试打印返回值时,得到了0。该值已正确插入

问题:不清楚返回值0的含义。因此,我希望有人向我解释insert函数返回值的含义,因为文档不是很清楚

这个int值代表什么?

这是

插入的文档数。如果耐久性为零,则此 值将为-1


因此,返回值0表示插入的文档数为0无。

请详细说明这个问题?文档说明了什么?@pst,MongoCollection.insert耐久性,documentsSignable。。。文档将一组文档插入到集合中。只有那个much@abhips我想你发现了一只虫子。在这一点上,我不确定它是在MongoDB中还是在驱动程序中,但插入结果中的“n”似乎总是返回为零。hi@Robmore,实际上我用一个简单的示例进行了尝试,并通过MongoShell检查了db。虽然我正确地插入了值,但返回值是0。实际上,文档是错误的。MongoDB服务器在插入“n”字段时始终返回零,该字段应该是受影响的文档数。看见