Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-522

mongosh should list "findOneAnd(x)" methods as alternatives to deprecated CRUD commands

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.10.0
    • Component/s: Shell API
    • Labels:
      None
    • Story Points:
      1
    • Documentation Changes:
      Not Needed

      Description

      Problem Description

      When running a deprecated CRUD method in mongosh, such as db.coll.remove(), it does not suggest db.coll.findOneAndDelete() as an alternative.

      Steps to Reproduce

      In mongosh, run db.coll.remove()

      Expected Results

      mongosh outputs:

      DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany, findOneAndDelete, or bulkWrite.
      

      Actual Results

      mongosh outputs:

      DeprecationWarning: Collection.remove() is deprecated. Use deleteOne, deleteMany or bulkWrite.
      

      Additional Notes

      This also applies to db.coll.update() and db.coll.save(), which should suggest db.coll.findAndModify

        Attachments

          Activity

            People

            Assignee:
            sergey.petushkov Sergey Petushkov
            Reporter:
            jeffrey.allen Jeffrey Allen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: