title: Map Mongodb document to java object document
body: <p>As we know, data stored in a mongo database can have special fields, like ObjectId.</p>
  <p>Using the spring data framework, when we execute a mongo query (find or aggregate) the data stored in mongodb are mapped to the type of result we want.</p>
  <p>plus ObjectId, I have other types that I save in <strong>X</strong> format, and I read in <strong>Y</strong> format.
  for example, I have a &quot;Location&quot; object</p>
  <pre><code>{
       &quot;latitude&quot;: 0.0,
       &quot;length&quot;: 0.0
  }
  </code></pre>
  <p>I store it in mongo in another format (array) so that I can make geolocation requests.</p>
  <p>I don't do this manually, but using read and write converters :</p>
  <pre><code>@ReadingConverter
  class ConverterLocationRead : Converter&lt;List&lt;Double&gt;, Location&gt;
  {
      
      override fun convert(source : List&lt;Double&gt;) : Location?
      {
          return if (source.isNullOrVoid() || source.size &lt; 2)
          {
              null
          }
          else
          {
              val result = Location()
              
              result.latitude = source[1]
              result.longitude = source[0]
              
              result
          }
      }
  }
  
  @WritingConverter
  class ConverterLocationWrite : Converter&lt;Location, List&lt;Double&gt;&gt;
  {
      
      override fun convert(source : Location) : List&lt;Double&gt;
      {
          return source.toDocument()
      }
  }
  </code></pre>
  <p>And then i create a bean to indicate for mongo how to map from/to this type</p>
  <pre><code>@Bean
  fun customConversions() : MongoCustomConversions
  {
      val converters = ArrayList&lt;Converter&lt;*,*&gt;&gt;()
      
      converters.add(ConverterLocationWrite())
      converters.add(ConverterLocationRead())
      
      return MongoCustomConversions(converters)
  }
  </code></pre>
  <p>my question is how to do if i want to map a data which is not stored to database?</p>
  <p>for example I have a json file containing a list of data that some fields are in the format that needs to be stored to mongo.</p>
  <p>how to use the same mongo mapper to transform my data as spring do when i read it directly from the database?</p>