-
Type: Task
-
Resolution: Duplicate
-
Priority: Major - P3
-
Affects Version/s: 1.0.0-alpha1
-
Component/s: None
-
None
PHPLIB currently has workarounds for extracting the _id from a document if it was not generated by the driver; however, this doesn't work if the _id was returning from a Serializable object, as it may not be an accessible property in the original insert() argument, nor is it currently returned by insert().
For example:
foreach ($this->documents as $i => $document) { $insertedId = $bulk->insert($document); if ($insertedId !== null) { $insertedIds[$i] = $insertedId; } else { $insertedIds[$i] = is_array($document) ? $document['_id'] : $document->_id; } }
- depends on
-
PHPC-471 BulkWrite::insert() should always return the document's ID
- Closed
- is duplicated by
-
PHPLIB-157 Improve _id extraction for Serializable objects
- Closed