Package com.mongodb

Class BulkWriteUpsert


  • public class BulkWriteUpsert
    extends Object
    Represents an upsert request in a bulk write operation that resulted in an insert. It contains the index of the upsert request in the operation and the value of the _id field of the inserted document.
    Since:
    2.12
    See Also:
    BulkWriteRequestBuilder.upsert()
    MongoDB documentation
    Bulk Upsert
    Since server release
    2.6
    • Constructor Detail

      • BulkWriteUpsert

        public BulkWriteUpsert​(int index,
                               Object id)
        Constructs an instance.
        Parameters:
        index - the index of the item that was upserted
        id - the value of the _id of the upserted item
    • Method Detail

      • getIndex

        public int getIndex()
        Gets the index of the upserted item based on the order it was added to the bulk write operation.
        Returns:
        the index
      • getId

        public Object getId()
        Gets the id of the upserted item.
        Returns:
        the id
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object