Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3371

The use of UpdateOneModel on MongoCollection#updateOne

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Won't Do
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • API
    • None
    • N/A

    Description

      Hey, I think it'd be cool if we were able to use the UpdateOneModel for MongoCollection#updateOne, I see this being pretty useful especially if you want to update a nested field based on if the document you're looking for is already there or not, so for one instance you'd use a push but the other you'd use a set one requiring an array filter and the other doesn't. Due to how it handles array filters if the array filter is unused it'll throw an exception, I think this would be a good way to avoid this as you can choose whether to have an array filter depending on the update.

      Attachments

        Activity

          People

            john.stewart@mongodb.com John Stewart (Inactive)
            sheacartwright4@gmail.com Shea Cartwright
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: