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

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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 0.10.0
    • Affects Version/s: None
    • Component/s: Shell API
    • None
    • 1
    • Not Needed

      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

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

              Created:
              Updated:
              Resolved: