title: How to get a document from mongodb by using its string id and string collection name in SpringData
body: <p>I know that generally, we need to do something similar to this for getting a document back from mongodb in spring data:</p>
  
  <ol>
  <li>Define a class and annotate it with @Document:</li>
  </ol>
  
  <pre><code>@Document ("persons")
  public class Person
  </code></pre>
  
  <ol start="2">
  <li>Use MongoTemplete:</li>
  </ol>
  
  <p><code>mongoOps.findById(p.getId(), Person.class);</code></p>
  
  <p>The problem is that in runtime I don't know the class type of the document, I just have its string collection name and its string Id. How is it possible to retrieve the document using SpringData? Something like this:</p>
  
  <pre><code>db.myCollectionName.findOne({_id: myId})
  </code></pre>
  
  <p>The result object type is not a concern, it can be even an object, I just want to map it to a jackson JsonNode.</p>