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

    • Bug
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • 0.10.0
    • Shell API
    • None
    • 1
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: