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

cursor.maxAwaitTimeMS()(mongoshメソッド)

cursor.maxAwaitTimeMS(<time limit>)

重要

mongosh メソッド

This page documents a mongosh method. This is not the documentation for a language-specific driver, such as Node.js.

MongoDB API ドライバーについては、各言語の「MongoDB ドライバーのドキュメント」を参照してください。

Capped コレクション の 追尾可能 (tailable) カーソル クエリに一致する新しいドキュメントをサーバーが待機する最大時間を指定します。クエリによって返されたカーソルを反復処理する方法の詳細については、「 mongoshでのカーソルの反復処理 」を参照してください。

The maxAwaitTimeMS() method has the following prototype form:

db.collection.find(
{ <query> },
{ <projection> }
).tailable( { awaitData: true } ).maxAwaitTimeMS( <milliseconds> )

The maxAwaitTimeMS() method has the following parameter:

Parameter
タイプ
説明

milliseconds

integer

新しいドキュメントの最大待機時間を指定します。

重要

This method, maxAwaitTimeMS(), sets a limit on how long a tailable cursor waits for the next response. maxTimeMS() sets a limit on total processing time.

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

  • 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.

  • MongoDB Enterprise: サブスクリプションベースの自己管理型 MongoDB バージョン

  • MongoDB Community: ソースが利用可能で、無料で使用できる自己管理型の MongoDB のバージョン

Capped salesコレクションをクエリして、エージェント メトリクスの月間売上合計を見つけます。

db.sales.find(
{ agent: "Mary Kay" },
{ _id: 0, agent: 1, weeklyTotal: 1 }
).tailable( { awaitData: true } ).maxAwaitTimeMS( 1000 )

The highlighted line creates a tailable cursor on the sales collection. The maxAwaitTimeMS() sets a one second maximum wait time for the next cursor update.

このページを評価

項目一覧