return value
-
The detailed result information (BSONObj object) is returned successfully, the structure is as follows:
{
InsertedNum : <INT32> 成功插入的记录数,不包含替代和忽略的记录,
DuplicatedNum : <INT32> 因重复键冲突被忽略或替代的记录数
}
-
When the user turns on
flag
the SDB_INSERT_RETURN_ID option of theoptions
parameter or the ReturnOID option of the parameter, the detailed result information also contains the "_id" field, as follows:- Single insert: directly return the content of the "_id" field of the inserted record.
- Batch insert: Return the contents of the "_id" field of the inserted record in an array.
-
An exception is thrown when an error occurs.
error
insert()
Common exceptions of functions are as follows:
When an exception is thrown, you can () getLastError get an error code , or through ) getLastErrMsg ( get an error message. You can refer to the common error handling guide to learn more.
version
v1.0 and above.
Click on Jushan Database Documentation Center for more information