title: Cannot get stored document from mongodb using spring data
body: <p>I have document with  <code>"_id" : ObjectId("5449567cdf97f277c50d1ce2")</code> but I am getting <code>null</code> when trying to get it by <code>id</code> using <code>findOne</code>. How to solve it? </p>
  
  <p><strong>main</strong></p>
  
  <pre><code>public class MongoDBJDBC {
      public static void main( String args[] ){
          ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("spring/applicationContext.xml");
  
          ProductService productService = context.getBean(ProductService.class);
          Product product = productService.get("5449567cdf97f277c50d1ce2"); // null here
          }
  }
  </code></pre>
  
  <p><strong>service</strong></p>
  
  <pre><code>@Service
  public class ProductService {
      @Autowired
      private ProductDao productDao;
      @Autowired
      private ProductPropertiesDao productPropertiesDao;
  
      public void add(Product product) {
          productDao.save(product);
      }
  
      public void update(Product product) {
          productDao.save(product);
      }
  
      public Product get(String id) {
          return productDao.get(id);
      }
  </code></pre>
  
  <p><strong>dao</strong></p>
  
  <pre><code>    @Repository
      public class ProductDao  {
  
          @Autowired
          private MongoOperations mongoOperations;
   public Product get(String id) {
          return mongoOperations.findOne(Query.query(Criteria.where("id").is(new ObjectId(id))), Product.class);
      }
  }
  </code></pre>
  
  <p><strong>entity</strong></p>
  
  <pre><code>@Document(collection = Product.COLLECTION_NAME)
  public class Product implements Serializable {
  
      public Product() {
      }
  
      public static final String COLLECTION_NAME = "product";
  
      @Id
      private String _id;
      private String name;
     }
  </code></pre>
  
  <p><strong>document</strong></p>
  
  <pre><code>{
      "_id" : ObjectId("5449567cdf97f277c50d1ce2"),
      "name" : "product"
  }
  </code></pre>