Only use GeneratedId for upserts, not inserts

Identifiers generated for inserts will be returned from WriteBatch::insert()
This commit is contained in:
Jeremy Mikola
2014-07-18 16:46:44 -04:00
parent 7429d1e9db
commit a438cf5c6a
3 changed files with 5 additions and 18 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ namespace MongoDB;
/**
* Value object for a document identifier that was generated by the driver or
* server during an insert or upsert operation, respectively.
* server during an upsert operation, respectively.
*/
final class GeneratedId
{
+4 -3
View File
@@ -23,8 +23,11 @@ class WriteBatch implements Countable
/**
* Adds an insert operation to the batch
*
* The document's "_id" will be returned (either from the provided document
* or a generated value from the driver).
*
* @param array|object $document Operation/document to add to insert
* @return self
* @return mixed Document identifier
*/
function insert($document) {
/*** CEF ***/
@@ -48,7 +51,6 @@ class WriteBatch implements Countable
* @param array|object $query Update criteria
* @param array|object $newObj Update modifier or replacement document
* @param array $updateOptions Update options (e.g. "upsert")
* @return self
*/
function update($query, $newObj, array $updateOptions = null)
{
@@ -94,7 +96,6 @@ class WriteBatch implements Countable
*
* @param array|object $query Deletion criteria
* @param array $deleteOptions Deletion options (e.g. "limit")
* @return self
*/
function delete($query, array $deleteOptions = null)
{
-14
View File
@@ -10,20 +10,6 @@ namespace MongoDB;
*/
final class WriteResult
{
/**
* Returns the GeneratedIds for any inserted documents
*
* @return GeneratedId[]
*/
public function getGeneratedIdsForInsert()
{
/* Return an array of identifiers generated by the driver for insert
* operations. Each GeneratedId has a batch index and the ID value.
*
* This supersedes the identifier-setting hack in the 1.x driver.
*/
}
/**
* Returns the GeneratedIds for any upserted documents
*