Multi document transaction in docker container vs windows installation

I was trying transaction in mongodb. First I tried with docker containerised instance of “mongodb/mongodb-community-server:latest”, that gives me an error that standalone instance does not support transactions which I also found in documentation. Then I tried with windows installation via MongoDB Community Server windows installer, now transactions are working. I couldn’t understand what’s the differences between them. I couldn’t found anything in documentation. My question is not how to do transaction in docker container, I know that can be achieved by replica set setup. I want to know why installed community server supports transaction and single instance container doesn’t, what’s the differences between them.

Docker container cluster description:

{ ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "Unspecified/localhost:27017" }", EndPoint: "Unspecified/localhost:27017", ReasonChanged: "ServerInitialDescription", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", LastHeartbeatTimestamp: null, LastUpdateTimestamp: "2024-01-26T00:58:47.1630530Z" }] }

Docker container build info:

{ "version" : "7.0.4", "gitVersion" : "38f3e37057a43d2e9f41a39142681a76062d582e", "modules" : [], "allocator" : "tcmalloc", "javascriptEngine" : "mozjs", "sysInfo" : "deprecated", "versionArray" : [7, 0, 4, 0], "openssl" : { "running" : "OpenSSL 3.0.2 15 Mar 2022", "compiled" : "OpenSSL 3.0.2 15 Mar 2022" }, "buildEnvironment" : { "distmod" : "ubuntu2204", "distarch" : "aarch64", "cc" : "/opt/mongodbtoolchain/v4/bin/gcc: gcc (GCC) 11.3.0", "ccflags" : "-Werror -include mongo/platform/basic.h -ffp-contract=off -fasynchronous-unwind-tables -g2 -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -gdwarf-5 -fno-omit-frame-pointer -fno-strict-aliasing -O2 -march=armv8.2-a -mtune=generic -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-const-variable -Wno-unused-but-set-variable -Wno-missing-braces -fstack-protector-strong -gdwarf64 -Wa,--nocompress-debug-sections -Wimplicit-fallthrough=5", "cxx" : "/opt/mongodbtoolchain/v4/bin/g++: g++ (GCC) 11.3.0", "cxxflags" : "-Woverloaded-virtual -Wpessimizing-move -Wno-maybe-uninitialized -fsized-deallocation -Wno-deprecated -std=c++20", "linkflags" : "-Wl,--fatal-warnings -B/opt/mongodbtoolchain/v4/bin -gdwarf-5 -pthread -Wl,-z,now -fuse-ld=lld -fstack-protector-strong -gdwarf64 -Wl,--build-id -Wl,--hash-style=gnu -Wl,-z,noexecstack -Wl,--warn-execstack -Wl,-z,relro -Wl,--compress-debug-sections=none -Wl,-z,origin -Wl,--enable-new-dtags", "target_arch" : "aarch64", "target_os" : "linux", "cppdefines" : "SAFEINT_USE_INTRINSICS 0 PCRE2_STATIC NDEBUG _XOPEN_SOURCE 700 _GNU_SOURCE _FORTIFY_SOURCE 2 ABSL_FORCE_ALIGNED_ACCESS BOOST_ENABLE_ASSERT_DEBUG_HANDLER BOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF BOOST_LOG_NO_SHORTHAND_NAMES BOOST_LOG_USE_NATIVE_SYSLOG BOOST_LOG_WITHOUT_THREAD_ATTR BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS BOOST_SYSTEM_NO_DEPRECATED BOOST_THREAD_USES_DATETIME BOOST_THREAD_VERSION 5" }, "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "storageEngines" : ["devnull", "wiredTiger"], "ok" : 1.0 }

Windows installation cluster description:

{ ClusterId : "1", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "10.69.13.10:27017" }", EndPoint: "10.69.13.10:27017", ReasonChanged: "ServerInitialDescription", State: "Disconnected", ServerVersion: , TopologyVersion: , Type: "Unknown", LastHeartbeatTimestamp: null, LastUpdateTimestamp: "2024-01-25T06:24:31.0074383Z" }] }

Windows installation buildInfo:

{ "version" : "6.0.1", "gitVersion" : "32f0f9c88dc44a2c8073a5bd47cf779d4bfdee6b", "targetMinOS" : "Windows 7/Windows Server 2008 R2", "modules" : [], "allocator" : "tcmalloc", "javascriptEngine" : "mozjs", "sysInfo" : "deprecated", "versionArray" : [6, 0, 1, 0], "openssl" : { "running" : "Windows SChannel" }, "buildEnvironment" : { "distmod" : "windows", "distarch" : "x86_64", "cc" : "cl: Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31107 for x64", "ccflags" : "/nologo /WX /FImongo/platform/basic.h /EHsc /W3 /wd4068 /wd4244 /wd4267 /wd4290 /wd4351 /wd4355 /wd4373 /wd4800 /wd4251 /wd4291 /we4013 /we4099 /we4930 /errorReport:none /MD /O2 /Oy- /bigobj /utf-8 /permissive- /Zc:__cplusplus /Zc:sizedDealloc /volatile:iso /diagnostics:caret /std:c++17 /Gw /Gy /Zc:inline", "cxx" : "cl: Microsoft (R) C/C++ Optimizing Compiler Version 19.31.31107 for x64", "cxxflags" : "/TP", "linkflags" : "/nologo /DEBUG /INCREMENTAL:NO /LARGEADDRESSAWARE /OPT:REF", "target_arch" : "x86_64", "target_os" : "windows", "cppdefines" : "SAFEINT_USE_INTRINSICS 0 PCRE_STATIC NDEBUG BOOST_ALL_NO_LIB _UNICODE UNICODE _SILENCE_CXX17_ALLOCATOR_VOID_DEPRECATION_WARNING _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING _SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING _SILENCE_ALL_CXX20_DEPRECATION_WARNINGS _CONSOLE _CRT_SECURE_NO_WARNINGS _ENABLE_EXTENDED_ALIGNED_STORAGE _SCL_SECURE_NO_WARNINGS _WIN32_WINNT 0x0A00 BOOST_USE_WINAPI_VERSION 0x0A00 NTDDI_VERSION 0x0A000000 BOOST_THREAD_VERSION 5 BOOST_THREAD_USES_DATETIME BOOST_SYSTEM_NO_DEPRECATED BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS BOOST_ENABLE_ASSERT_DEBUG_HANDLER BOOST_LOG_NO_SHORTHAND_NAMES BOOST_LOG_USE_NATIVE_SYSLOG BOOST_LOG_WITHOUT_THREAD_ATTR ABSL_FORCE_ALIGNED_ACCESS" }, "bits" : 64, "debug" : false, "maxBsonObjectSize" : 16777216, "storageEngines" : ["devnull", "ephemeralForTest", "wiredTiger"], "ok" : 1.0 }

Certainly the Windows is configured as a single member replica set.

db.hello() or db.serverCmdLineOpts() will show this.

1 Like

Thanks for reply. Here is the output of both situation. Can you please point out the diff?

Docker instance “db.hello()” output


isWritablePrimary: true,

topologyVersion: {

processId: ObjectId('65b44937a786bc8b0f499c0e'),

counter: Long('0')

},

maxBsonObjectSize: 16777216,

maxMessageSizeBytes: 48000000,

maxWriteBatchSize: 100000,

localTime: 2024-01-27T00:08:19.666Z,

logicalSessionTimeoutMinutes: 30,

connectionId: 11,

minWireVersion: 0,

maxWireVersion: 21,

readOnly: false,

ok: 1

}```

Docker instance "db.serverCmdLineOpts()" output

```{

argv: [ 'mongod', '--auth', '--bind_ip_all' ],

parsed: { net: { bindIp: '*' }, security: { authorization: 'enabled' } },

ok: 1

}

Installed server "db.hello()" output
{
isWritablePrimary: true,
topologyVersion: {
processId: ObjectId('65a106d90ffb24da2e6deade'),
counter: Long('0')
},
maxBsonObjectSize: 16777216,
maxMessageSizeBytes: 48000000,
maxWriteBatchSize: 100000,
localTime: ISODate('2024-01-28T06:05:43.077Z'),
logicalSessionTimeoutMinutes: 30,
connectionId: 168,
minWireVersion: 0,
maxWireVersion: 17,
readOnly: false,
ok: 1
}

Installed server "db.serverCmdLineOpts()"
{
argv: [
'C:\\Program Files\\MongoDB\\Server\\6.0\\bin\\mongod.exe',
'--config',
'C:\\Program Files\\MongoDB\\Server\\6.0\\bin\\mongod.cfg',
'--service'
],
parsed: {
config: 'C:\\Program Files\\MongoDB\\Server\\6.0\\bin\\mongod.cfg',
net: { bindIp: '0.0.0.0', port: 27017 },
service: true,
storage: {
dbPath: 'C:\\Program Files\\MongoDB\\Server\\6.0\\data',
journal: { enabled: true }
},
systemLog: {
destination: 'file',
logAppend: true,
path: 'C:\\Program Files\\MongoDB\\Server\\6.0\\log\\mongod.log'
}
},
ok: 1
}```

Both look to be standalone / no replicaset configured. To the best of my knowledge neither should be supporting transactions.

That’s where my confusion is. I don’t understand what’s the differences.