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

Support missing bson field in documents

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Scala
    • None
    • Hide

      Something like:

      If an bson array field is missing from the document, it will be populated as an empty collection at runtime.

      Show
      Something like: If an bson array field is missing from the document, it will be populated as an empty collection at runtime.

      Goal: Be able to deserialize documents where

      • field is missing
      • field type is a child of `Iterable`

      to ease changes in models without having to run scripts or write custom codecs.

       

      Now, this won't work,
      but we could expect that `metadata` and `aliases` are considered as empty, or at least having a setting in the client to enable it.

      Unable to find source-code formatter for language: bson. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      {
        "name": "John Doe"
      }
      

       

      
      case class Person(name: String, aliases: Set[String], metadata: Map[String, String])
      
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            gael.ferrachat@newsbridge.io Gaël Ferrachat
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: