ExportXMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: Collection Management
    • None
    • 2
    • None
    • PHP Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Context

      PHPLIB-675 introduced generic getters on CollectionInfo (getType(), getInfo(), getOptions(), getIdIndex()) and, as part of that change, deprecated three capped-collection helpers in PHPDoc only. See https://jira.mongodb.org/browse/PHPLIB-675, PR #839 (https://github.com/mongodb/mongo-php-library/pull/839) and docs PR #841 (https://github.com/mongodb/mongo-php-library/pull/841). The annotation reads @deprecated 1.0 Deprecated in favor of using getOptions, even though the deprecation was introduced in 1.9.0.

      Deprecated helpers

      • getCappedMax()
      • getCappedSize()
      • isCapped()

      The deprecation is documentation only. No runtime notice is emitted, and the methods are still present and functional on both 1.21 and 2.x.

      Problem

      A PHPDoc-only deprecation with no removal path creates avoidable churn in downstream projects. A concrete example: the Drupal MongoDB module is considering rewriting its capped-collection check to avoid isCapped() purely because of this annotation, with no functional benefit.

      Source on branch v1.21

      Same annotation on 2.x

      Proposal

      Remove the @deprecated annotations from isCapped(), getCappedMax() and getCappedSize() on the 1.21 branch, and mirror the change on 2.x.

      These helpers are thin, type-safe wrappers over getOptions(): isCapped() returns a bool and avoids the undefined-key pitfall of getOptions()['capped'] ?? false. They have been kept for several releases with no sign of removal, so the deprecation signal is misleading.

      Notes

      • Removing a deprecation is not a breaking change.
      • If the maintainers prefer to keep a deprecation, the alternative is to commit to an actual removal in a future major and state it in the annotation. The current state (deprecated, never removed, no runtime notice) is the worst of both worlds.
      • This is independent of the server-side collStats deprecation: isCapped() reads the listCollections output (options.capped), which is the non-deprecated path defined by the Enumerating Collections spec.

      Acceptance criteria

      • @deprecated removed from the three helpers on 1.21.
      • Same change applied to 2.x.
      • No behavior change.

            Assignee:
            Jérôme Tamarelle
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: