Hi,
I am working with a tailable cursor to read live changes from a MongoDB capped collection.
The behavior I am seeing:
- Inserts made from the same machine where the tailable cursor code is running → detected successfully.
- Inserts made from a different remote machine → not detected by the tailable cursor (no events fired, no new documents seen).
Setup details:
- MongoDB version: 7 (Community)
- Deployment type: Standalone / Replica Set (tested with both)
- OS: Windows10
- Language / Driver version: C#, MongoDB Driver
Code snippet (simplified):
var options = new FindOptions<MyDoc>
{
CursorType = CursorType.TailableAwait
};
using (var cursor = collection.FindSync(filter, options))
{
while (cursor.MoveNext())
{
foreach (var doc in cursor.Current)
{
Console.WriteLine(doc);
}
}
}
What I have checked so far:
- The collection is capped.
- Both local and remote machines can insert into the same collection (confirmed via
mongosh
query). Using Compass also - Network access between machines is working fine.
- No errors or exceptions in the tailable cursor loop.
Questions:
- Why would a tailable cursor detect inserts from the local machine but miss inserts from a remote machine?
- Is there any difference in how MongoDB treats inserts from different clients for capped collections?
- Could this be related to write concern, replication, or caching behavior?
Any pointers or troubleshooting steps would be appreciated.
Thanks!