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

oplog アクセス権限

注意

This page applies to Atlas Infinite clusters and Atlas Core clusters. On an Atlas Infinite cluster, you can read the oplog collection as described on this page, but you can't set an oplog size. The collection serves change streams and some internal functions rather than replication, which the storage layer handles. To learn how the oplog behaves on an Atlas Infinite cluster, see Oplog on Atlas Infinite clusters.

特別な 上限付きコレクションである oplog は、データベースに保存されているデータを変更する操作を記録します。

You must precede a $regex query on an oplog in a Free cluster or a Flex cluster with a carat (^). Otherwise, the following error occurs:

MongoServerError: Oplog ns RegEx queries must begin with ^

oplog にアクセスするには、データベースユーザーがlocalデータベースに対する読み取りアクセス権を持っている必要があります。localに読み取りアクセス権を持つユーザーを作成する:

1
  1. まだ表示されていない場合は、プロジェクトを含む組織をナビゲーション バーの Organizations メニューで選択します。

  2. まだ表示されていない場合は、ナビゲーション バーの Projects メニューからプロジェクトを選択します。

  3. サイドバーで、 Security見出しの下のDatabase & Network Accessをクリックします。

The Database & Network Access page displays after you complete the preceding steps.

2
  1. まだ表示されていない場合は、Database Usersタブをクリックします。

  2. Add New Database Userをクリックし、 oploguserなどのユーザー名を入力します。

  3. Grant Specific Privilegesをクリックし、 readロールとlocalデータベースを選択します。これにより、ユーザーのlocalデータベースに対する読み取り操作が制限されます。

  4. パスワードを入力し、[Add User] をクリックします。

  1. Connect to your cluster with the mongosh, using the credentials of the new database user with access to the local database.

  2. local データベースに切り替えます。

    > use local
  3. oplog コレクションの名前は oplog.rs です。データベース書き込み操作は、タイムスタンプ フィールドとウォールクロック フィールドを使用して日付順に記録されます。

    タイムスタンプフィールドには、エポックからの秒数を示す整数が含まれます。

注意

  • クラスターの oplog のサイズを増やすには、 「oplog サイズの設定」を参照してください。

  • MongoDB のコマンド replSetResizeOplog を使用して oplog のサイズを変更することはできません。