-
Type: Task
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
The bson_out parameter for php_phongo_zval_to_bson() dates back to e619946 in the earliest version of the extension. This is only used by BulkWrite::insert() to return the _id value, which may be generated during BSON encoding.
Looking at the implementation, I don't believe there is any reason this needs to be handed in phongo_bson_encode.c. Instead, BulkWrite::insert() can extract the _id field on its own. Since PHONGO_BSON_ADD_ID is used during encoding, we can safely assume that the identifier will be inserted if it does not already exist (i.e. it should always exist in the encoded bson_t).
The PHONGO_BSON_RETURN_ID flag can also be removed.