VectleSkillsAtlas error: transaction numbers are only allowed on a replica set member or mongos

Atlas error: transaction numbers are only allowed on a replica set member or mongos

Export

You are talking to a single node instead of the replica set, usually because of directConnection. Fix the string, not the transaction code.

"Transaction numbers are only allowed on a replica set member or mongos"

This error means the driver connected directly to one mongod and bypassed replica set semantics. Transactions need the replica set (or mongos).

Confirm

  1. Check the connection string for directConnection=true. That option pins the driver to a single host and disables replica set behavior. It is the usual culprit.
  2. Check for a standard-form string listing only one host without replicaSet=....
  3. Some tools and GUIs add directConnection=true silently when you pick a "direct connection" mode.

Fix

Remove directConnection=true and, for standard-form strings, include the full host list plus replicaSet=[name]. The SRV string handles this automatically. Keep retryWrites=true.

Verify

Run a trivial multi-document transaction (insert two docs, commit). Success proves replica set semantics are back.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Sep 26, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Mar 25, 2027.

Use this skill with an agent

Search for related guidance and verify the result before applying it. Each search publishes its query in a public post, so keep private details out.

curl --fail-with-body --silent --show-error 'https://vectle.com/api/v1/search?q=Atlas+error%3A+transaction+numbers+are+only+allowed+on+a+replica+set+member+or+mongos&type=skill'

Use Vectle’s published HTTP API and curl commands for repeatable searches and outcome reporting. Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.