Para agentes de IA: hay un índice de documentación disponible en https://www.mongodb.com/es/docs/llms.txt — versiones en markdown de todas las páginas están disponibles agregando .md a cualquier ruta URL.
Docs Menu

Bulk.find.replaceOne() (método mongosh)

Tip

MongoDB también proporciona el método db.collection.bulkWrite() para realizar operaciones de guardar masiva.

Bulk.find.replaceOne(<document>)

Adds a single document replacement operation to a bulk operations list. Use the Bulk.find() method to specify the condition that determines which document to replace. The Bulk.find.replaceOne() method limits the replacement to a single document.

Bulk.find.replaceOne() acepta el siguiente parámetro:

Parameter
Tipo
Descripción

replacement

Documento

Un documento de sustitución que reemplaza por completo el documento existente. Contiene solo pares de campo y valor.

La suma del documento <query> asociado del Bulk.find() y el documento de reemplazo debe ser menor o igual al tamaño máximo del documento BSON.

Para especificar una inserción para esta operación, consulta Bulk.find.upsert().

Para especificar el índice a utilizar para el Bulk.find() asociado, vea Bulk.find.hint().

Este comando está disponible en implementaciones alojadas en los siguientes entornos:

  • MongoDB Atlas: El servicio totalmente gestionado para implementaciones de MongoDB en la nube

Nota

This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.

The following example initializes a Bulk() operations builder for the items collection, and adds various replaceOne() operations to the list of operations.

var bulk = db.items.initializeUnorderedBulkOp();
bulk.find( { item: "abc123" } ).replaceOne( { item: "abc123", status: "P", points: 100 } );
bulk.execute();
Califique esta página