Skip to content

enh(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 - #5359

Merged
matejk merged 7 commits into
mainfrom
mongodb-6-7-8-compat-doc-and-fixes
May 19, 2026
Merged

enh(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256#5359
matejk merged 7 commits into
mainfrom
mongodb-6-7-8-compat-doc-and-fixes

Conversation

@matejk

@matejk matejk commented May 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Audit of Poco::MongoDB versus MongoDB server 6.0 / 7.0 / 8.0, plus a set
of contained gap closures for the 1.15.3 release. The branch ships six
commits: five feature/docs commits and one consolidated review-feedback
fix commit produced by a four-agent code review (general / simplification

  • C++17 / comments / README accuracy).

Server-feature compatibility doc

  • New MongoDB/README.md with status tables for MongoDB 6.0 / 7.0 / 8.0
    server features (driver baseline, aggregation, indexes, BSON types),
    plus a section listing features obsolete in recent MongoDB that are
    still exposed by Poco (e.g. CMD_MAP_REDUCE, CMD_COUNT,
    INDEX_BACKGROUND).

New API surface

  • Database::createIndex(connection, coll, fields, name, extraOptions, ...)
    overload: every element of extraOptions is merged into the per-index
    spec, making partialFilterExpression (3.2+), collation (3.4+),
    wildcardProjection (4.2+ / 7.0 compound wildcard), text / 2dsphere /
    geo options reachable from the typed helper.
  • New Database::INDEX_HIDDEN flag (MongoDB 4.4+).
  • New BSON types Decimal128 (TypeId 0x13, MongoDB 3.4+) with
    canonical IEEE 754-2008 string conversion, MinKey (TypeId 0xFF),
    MaxKey (TypeId 0x7F). Document::read no longer throws
    NotImplementedException on these types.
  • New AUTH_SCRAM_SHA256 constant; Database::authenticate() default
    flipped from SCRAM-SHA-1 to SCRAM-SHA-256, matching the MongoDB
    server default for users created since 4.0 and the convention used
    by every official MongoDB driver. ASCII passwords only on the
    SCRAM-SHA-256 path; non-ASCII throws NotImplementedException
    pending full SASLprep (RFC 4013).
  • Connection::connect(uri, ...) accepts tls=true as an alias for
    the historical ssl=true URI option. URI default authMechanism
    also flipped to SCRAM-SHA-256 to match Database::authenticate().

Deprecations / modernization

  • OpMsgMessage::CMD_MAP_REDUCE marked POCO_DEPRECATED (mapReduce
    deprecated by MongoDB in 5.0). Use the aggregation pipeline.
  • Database::INDEX_BACKGROUND marked POCO_DEPRECATED (4.2 server
    no-op). Kept for source compatibility; no longer forwarded.
  • Database::count() rewritten internally to use aggregation
    [{$count: "n"}] rather than the legacy count command. Same
    signature. Aggregation $count is in the Stable API v1, accurate on
    sharded clusters, and permitted in multi-document transactions.

Tests

98 offline tests pass (8 new BSONTest cases for createIndex element
merging, Decimal128 specials / parsing / round-trip / serialization with
trailing-zero preservation per the BSON spec, plus SyntaxException /
RangeException paths, MinKey/MaxKey serialization, auth constants, the
SASLprep ASCII guard, and the tls= URI alias).

Notes

  • The CHANGELOG is owned separately and left untouched in this PR.
    User-visible changes that warrant entries: the two default-auth
    flips (Database::authenticate() and Connection::connect(uri)
    URI), Database::count() internal rewrite, INDEX_BACKGROUND /
    CMD_MAP_REDUCE POCO_DEPRECATED markings, plus the new feature
    bullets (createIndex extraOptions overload, INDEX_HIDDEN,
    Decimal128 / MinKey / MaxKey, tls= URI alias).
  • This PR targets the 1.15.3 release.

Test plan

  • cmake -B build -DENABLE_TESTS=ON -DPOCO_MINIMAL_BUILD=ON -DENABLE_MONGODB=ON -DENABLE_FOUNDATION=ON -DENABLE_NET=ON -DENABLE_CRYPTO=ON -DENABLE_JSON=ON -DENABLE_UTIL=ON
  • cmake --build build --target MongoDB-testrunner
  • POCO_BASE=$PWD PATH="$PATH:$PWD/build/bin" ./build/bin/MongoDB-testrunner -all -- expect 98 OK.

@matejk matejk added this to the Release 1.15.3 milestone May 19, 2026
Comment thread MongoDB/src/Decimal128.cpp Fixed
@matejk matejk changed the title feat(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 (1.15.3) feat(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 May 19, 2026
@matejk
matejk force-pushed the mongodb-6-7-8-compat-doc-and-fixes branch from c95ea9d to d3f891a Compare May 19, 2026 13:02
matejk added 6 commits May 19, 2026 15:07
Status tables for MongoDB 6.0/7.0/8.0 features (driver baseline,
aggregation, indexes, BSON types) plus features obsolete in recent
MongoDB that Poco still exposes. "Added 1.15.x" rows refer to the
gap-closing commits that follow in this patch series.
New Database::createIndex overload taking a Document::Ptr extraOptions
merged into the per-index spec, making partialFilterExpression (3.2+),
collation (3.4+), wildcardProjection (4.2+ / 7.0 compound),
text/2dsphere/geo options reachable from the typed helper. Add
INDEX_HIDDEN (4.4+). Mark INDEX_BACKGROUND POCO_DEPRECATED (server
no-op since 4.2); kept for source compat, no longer forwarded.
Document::read previously threw NotImplementedException on TypeIds
0x13, 0xFF, 0x7F. Decimal128 implements the IEEE 754-2008 BID format
with canonical string conversion per Section 5.12.4; MinKey and MaxKey
are zero-payload sentinels used in shard-key bounds and admin command
output. No arithmetic on Decimal128 -- round-trip through std::string
for ops.
SCRAM-SHA-256 (MongoDB 4.0+) is the server default for new users.
Database::authenticate() default flipped from SHA-1 to SHA-256; pass
AUTH_SCRAM_SHA1 explicitly for legacy deployments. Internal SCRAM
math factored into a templated runScramAuth<HashEngine> shared by
both mechanisms.

SASLprep (RFC 4013) on the password: ASCII fast-path only, non-ASCII
throws NotImplementedException pending full SASLprep.
- CMD_MAP_REDUCE: POCO_DEPRECATED (mapReduce deprecated by MongoDB in 5.0).
- Database::count() now uses aggregation [{$count:"n"}]: Stable API v1,
  accurate on sharded clusters, allowed in transactions.
- Connection URI parser accepts "tls=" as an alias for "ssl=" (canonical
  since 4.2).
Bugs:
- README Quick Start example did not compile against the actual API.
- Connection::connect(uri) URI default authMechanism still SHA-1,
  contradicting the doc-comment after the SHA-256 flip; aligned to SHA-256.
- Decimal128::fromString silently accepted "1E"/"1E+" as the mantissa;
  now requires at least one exponent digit.
- Decimal128::fromString stripped trailing zeros from the coefficient,
  breaking the canonical (coefficient, exponent) pair per the BSON spec.
- Decimal128::toString large-coefficient path emitted "0E-1" instead of
  "0.0" for negative exponents; falls through to the standard renderer.
- Database::INDEX_SPARSE doc-comment attached to the wrong enumerator.
- testConnectionURITlsAlias third case had an inaccurate comment.
- CodeQL: removed for-loop counter mutation in Decimal128::fromString.

Cleanup: dead constants renamed in Decimal128.cpp; toString digit
emission consolidated; isAsciiOnly uses std::all_of; named constexpr
bools at runScramAuth call sites; tls test replaced with a 3-line
lambda; restates-WHAT comments trimmed; README version phrasing
normalized to "(since X.Y)".

Tests extended with trailing-zero preservation, SyntaxException and
RangeException paths in Decimal128.
@matejk
matejk force-pushed the mongodb-6-7-8-compat-doc-and-fixes branch from d3f891a to c188bf3 Compare May 19, 2026 13:07
@matejk matejk changed the title feat(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 eng(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 May 19, 2026
Windows can reject an oversized SharedMemory allocation with either
ERROR_NOT_ENOUGH_MEMORY (8) or ERROR_NO_SYSTEM_RESOURCES (1450)
depending on which allocator tier runs out first; the test only
accepted the former, intermittently failing on windows-2025 CI
runners.
@matejk matejk changed the title eng(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 enh(MongoDB): MongoDB 6.0/7.0/8.0 compat -- partial indexes, Decimal128, SCRAM-SHA-256 May 19, 2026
@matejk
matejk merged commit bdf9fba into main May 19, 2026
52 checks passed
@matejk
matejk deleted the mongodb-6-7-8-compat-doc-and-fixes branch May 20, 2026 08:00
matejk added a commit that referenced this pull request May 20, 2026
…28, SCRAM-SHA-256 (#5359)

* docs(MongoDB): add server-feature compatibility README

Status tables for MongoDB 6.0/7.0/8.0 features (driver baseline,
aggregation, indexes, BSON types) plus features obsolete in recent
MongoDB that Poco still exposes. "Added 1.15.x" rows refer to the
gap-closing commits that follow in this patch series.

* feat(MongoDB): partial / hidden / collation / wildcard index options

New Database::createIndex overload taking a Document::Ptr extraOptions
merged into the per-index spec, making partialFilterExpression (3.2+),
collation (3.4+), wildcardProjection (4.2+ / 7.0 compound),
text/2dsphere/geo options reachable from the typed helper. Add
INDEX_HIDDEN (4.4+). Mark INDEX_BACKGROUND POCO_DEPRECATED (server
no-op since 4.2); kept for source compat, no longer forwarded.

* feat(MongoDB): add Decimal128, MinKey, MaxKey BSON types

Document::read previously threw NotImplementedException on TypeIds
0x13, 0xFF, 0x7F. Decimal128 implements the IEEE 754-2008 BID format
with canonical string conversion per Section 5.12.4; MinKey and MaxKey
are zero-payload sentinels used in shard-key bounds and admin command
output. No arithmetic on Decimal128 -- round-trip through std::string
for ops.

* feat(MongoDB): add SCRAM-SHA-256 authentication

SCRAM-SHA-256 (MongoDB 4.0+) is the server default for new users.
Database::authenticate() default flipped from SHA-1 to SHA-256; pass
AUTH_SCRAM_SHA1 explicitly for legacy deployments. Internal SCRAM
math factored into a templated runScramAuth<HashEngine> shared by
both mechanisms.

SASLprep (RFC 4013) on the password: ASCII fast-path only, non-ASCII
throws NotImplementedException pending full SASLprep.

* chore(MongoDB): mark deprecated features, rewrite count(), tls URI alias

- CMD_MAP_REDUCE: POCO_DEPRECATED (mapReduce deprecated by MongoDB in 5.0).
- Database::count() now uses aggregation [{$count:"n"}]: Stable API v1,
  accurate on sharded clusters, allowed in transactions.
- Connection URI parser accepts "tls=" as an alias for "ssl=" (canonical
  since 4.2).

* fix(MongoDB): apply review feedback

Bugs:
- README Quick Start example did not compile against the actual API.
- Connection::connect(uri) URI default authMechanism still SHA-1,
  contradicting the doc-comment after the SHA-256 flip; aligned to SHA-256.
- Decimal128::fromString silently accepted "1E"/"1E+" as the mantissa;
  now requires at least one exponent digit.
- Decimal128::fromString stripped trailing zeros from the coefficient,
  breaking the canonical (coefficient, exponent) pair per the BSON spec.
- Decimal128::toString large-coefficient path emitted "0E-1" instead of
  "0.0" for negative exponents; falls through to the standard renderer.
- Database::INDEX_SPARSE doc-comment attached to the wrong enumerator.
- testConnectionURITlsAlias third case had an inaccurate comment.
- CodeQL: removed for-loop counter mutation in Decimal128::fromString.

Cleanup: dead constants renamed in Decimal128.cpp; toString digit
emission consolidated; isAsciiOnly uses std::all_of; named constexpr
bools at runScramAuth call sites; tls test replaced with a 3-line
lambda; restates-WHAT comments trimmed; README version phrasing
normalized to "(since X.Y)".

Tests extended with trailing-zero preservation, SyntaxException and
RangeException paths in Decimal128.

* test(Foundation): accept ERROR_NO_SYSTEM_RESOURCES in SharedMemoryTest

Windows can reject an oversized SharedMemory allocation with either
ERROR_NOT_ENOUGH_MEMORY (8) or ERROR_NO_SYSTEM_RESOURCES (1450)
depending on which allocator tier runs out first; the test only
accepted the former, intermittently failing on windows-2025 CI
runners.
matejk added a commit that referenced this pull request May 20, 2026
Four PRs merged on main after the release commit and cherry-picked
into poco-1.15.3:

- #5358 fix(AbstractEvent): operator-= holds the event mutex across
  Delegate destructor
- #5359 enh(MongoDB): MongoDB 6.0/7.0/8.0 compat (carries its own
  API Changes block for SCRAM-SHA-256 default, count() via $count,
  deprecated INDEX_BACKGROUND / CMD_MAP_REDUCE)
- #5355 (GH #5354) feat(CppUnit): terminate handler
- #5356 fix(Foundation): gate atomic_flag::test on C++20 atomic_wait

Also tighten the Summary paragraph to call out the MongoDB compat
work and add the MongoDB API Changes to doc/99100-ReleaseNotes.page
to match CHANGELOG. CONTRIBUTORS unchanged -- all four PR authors
(aleks-f, uilianries, matejk) are already listed.
matejk added a commit that referenced this pull request May 20, 2026
…5.3 overview

Four PRs merged on main after the release commit and cherry-picked
into poco-1.15.3:

- #5358 fix(AbstractEvent): operator-= holds the event mutex across
  Delegate destructor
- #5359 enh(MongoDB): MongoDB 6.0/7.0/8.0 compat (carries its own
  API Changes for SCRAM-SHA-256 default, count() via $count,
  deprecated INDEX_BACKGROUND / CMD_MAP_REDUCE)
- #5355 (GH #5354) feat(CppUnit): terminate handler
- #5356 fix(Foundation): gate atomic_flag::test on C++20 atomic_wait

Also tighten the 1.15.3 entries: trim the Summary paragraph, replace
multi-paragraph API Changes prose with one-line bullets, drop
redundant qualifiers from bug-fix / enhancement bullets, and use the
verbatim GitHub issue/PR titles for each item. CHANGELOG and
doc/99100-ReleaseNotes.page now carry the same content. CONTRIBUTORS
unchanged -- all four PR authors (aleks-f, uilianries, matejk) are
already listed.
matejk added a commit that referenced this pull request May 20, 2026
…5.3 overview

Four PRs merged on main after the release commit and cherry-picked
into poco-1.15.3:

- #5358 fix(AbstractEvent): operator-= holds the event mutex across
  Delegate destructor
- #5359 enh(MongoDB): MongoDB 6.0/7.0/8.0 compat (carries its own
  API Changes for SCRAM-SHA-256 default, count() via $count,
  deprecated INDEX_BACKGROUND / CMD_MAP_REDUCE)
- #5355 (GH #5354) feat(CppUnit): terminate handler
- #5356 fix(Foundation): gate atomic_flag::test on C++20 atomic_wait

Also tighten the 1.15.3 entries: trim the Summary paragraph, replace
multi-paragraph API Changes prose with one-line bullets, drop
redundant qualifiers from bug-fix / enhancement bullets, and use the
verbatim GitHub issue/PR titles for each item. CHANGELOG and
doc/99100-ReleaseNotes.page now carry the same content. CONTRIBUTORS
unchanged -- all four PR authors (aleks-f, uilianries, matejk) are
already listed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants