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

Shortcut for doc lookup by _id

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: API, Query Operations
    • Labels:
      None

      Very often, we need to simply look up a document by _id. What we have to do is use findOne() and updateOne() with eq("_id", <id value>). Since there's no official constant for "_id" we also have to define our own constant. This seems like something that can be easily provided in an official capacity. Ideally, this would be methods in MongoCollection like findById(<id value>), updateOneById(<id value>, <update>), and so on.

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            blake_bauman@apple.com Blake Bauman
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: