AI エージェント向け: ドキュメントインデックスは https://www.mongodb.com/ja-jp/docs/llms.txt で利用できます。すべてのページの markdown バージョンは、いずれかの URL パスに .md を追加することで利用できます。
Docs Menu

Bulk.find.replaceOne()(mongoshメソッド)

Tip

MongoDB は、一括書き込み操作を実行するための Mongo.bulkWrite() メソッドも提供します。

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() は、次のパラメーターを受け入れます。

Parameter
タイプ
説明

replacement

ドキュメント

既存のドキュメントを完全に置き換える置換ドキュメント。 フィールドと値のペアのみが含まれます。

Bulk.find()からの関連する<query>ドキュメントと置換ドキュメントの合計は、 BSON ドキュメントの最大サイズ 以下である必要があります。

この操作のアップサートを指定するには、 Bulk.find.upsert()を参照してください。

関連する Bulk.find() に使用するインデックスを指定するには、Bulk.find.hint()を参照してください。

このコマンドは、次の環境でホストされている配置で使用できます。

  • MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud

注意

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();
このページを評価

項目一覧