mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-04-28 02:53:21 +02:00
Only use GeneratedId for upserts, not inserts
Identifiers generated for inserts will be returned from WriteBatch::insert()
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user