title: Spring mongo data repository findAll() return empty?
body: <p>I'm a newbie in Spring Framework. I'm trying to create a small REST API by using Spring Rest with MongoDB.
  And when I create the repository to get data from MongoDb, the findAll() function always return an empty list. Here is my repository:</p>
  
  <pre><code>   @RepositoryRestResource(collectionResourceRel = "meal", path = "meal")
     public interface MealRepository extends MongoRepository&lt;Meal, Integer&gt; {
  
         @Override
         public List&lt;Meal&gt; findAll();
  
         @Override
         public Meal findOne(Integer id);
     }
  </code></pre>
  
  <p>And Controller:</p>
  
  <pre><code>@RestController
  public class MealApiController {
  
      @Autowired
      MealRepository mMealRepository;
  
      @RequestMapping(value = "/meal/detail", method = RequestMethod.GET)
      public @ResponseBody Meal mealDetailGet(@RequestParam(value = "id", required = true) Integer id) {
          Meal meal = mMealRepository.findOne(id);
          return meal;
      }
  
      @RequestMapping(value = "/meal/all", method = RequestMethod.GET)
      public @ResponseBody List&lt;Meal&gt; getAllMeal() {
          return mMealRepository.findAll();
      }
  
      @RequestMapping(value = "/meal/list", method = RequestMethod.GET)
      public @ResponseBody List&lt;Meal&gt; mealListGet(@RequestParam(value = "menu_id", required = true) Integer menuId) {
          List&lt;Meal&gt; response = mMealRepository.findByMenuId(menuId);
          return response;
      }
  
  }
  </code></pre>
  
  <p>Meal model:</p>
  
  <pre><code>@Document(collection = "meal_items")
  public class Meal {
  
      @Id
      @JsonProperty("_id")
      private int id;
  
      @JsonProperty("menu_id")
      private int menuId;
  
      @JsonProperty("name")
      private String name = null;
  
      @JsonProperty("image")
      private List&lt;String&gt; image = new ArrayList&lt;String&gt;();
  
      @JsonProperty("material")
      private List&lt;String&gt; material = new ArrayList&lt;String&gt;();
  
      @JsonProperty("guide")
      private List&lt;String&gt; guide = new ArrayList&lt;String&gt;();
  
      public Meal id(int id) {
          this.id = id;
          return this;
      }
  
      /**
       * Unique identifier representing a specific Meal.
       * 
       * @return id
       **/
      public int getId() {
          return id;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public Meal menuId(int menuId) {
          this.menuId = menuId;
          return this;
      }
  
      /**
       * Unique identifier representing a specific Menu containing the meal.
       * 
       * @return menuId
       **/
      public int getMenuId() {
          return menuId;
      }
  
      public void setMenuId(int menuId) {
          this.menuId = menuId;
      }
  
      public Meal name(String name) {
          this.name = name;
          return this;
      }
  
      /**
       * Display name of meal.
       * 
       * @return name
       **/
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public Meal image(List&lt;String&gt; image) {
          this.image = image;
          return this;
      }
  
      public Meal addImageItem(String imageItem) {
          this.image.add(imageItem);
          return this;
      }
  
      /**
       * Image URL representing the meal.
       * 
       * @return image
       **/
      public List&lt;String&gt; getImage() {
          return image;
      }
  
      public void setImage(List&lt;String&gt; image) {
          this.image = image;
      }
  
      public Meal material(List&lt;String&gt; material) {
          this.material = material;
          return this;
      }
  
      public Meal addMaterialItem(String materialItem) {
          this.material.add(materialItem);
          return this;
      }
  
      /**
       * List material used to cook the meal.
       * 
       * @return material
       **/
      public List&lt;String&gt; getMaterial() {
          return material;
      }
  
      public void setMaterial(List&lt;String&gt; material) {
          this.material = material;
      }
  
      public Meal guide(List&lt;String&gt; guide) {
          this.guide = guide;
          return this;
      }
  
      public Meal addGuideItem(String guideItem) {
          this.guide.add(guideItem);
          return this;
      }
  
      /**
       * Steps cooking the meal.
       * 
       * @return guide
       **/
      public List&lt;String&gt; getGuide() {
          return guide;
      }
  
      public void setGuide(List&lt;String&gt; guide) {
          this.guide = guide;
      }
  
      @Override
      public boolean equals(java.lang.Object o) {
          if (this == o) {
              return true;
          }
          if (o == null || getClass() != o.getClass()) {
              return false;
          }
          Meal meal = (Meal) o;
          return Objects.equals(this.id, meal.id) &amp;&amp; Objects.equals(this.menuId, meal.menuId)
                  &amp;&amp; Objects.equals(this.name, meal.name) &amp;&amp; Objects.equals(this.image, meal.image)
                  &amp;&amp; Objects.equals(this.material, meal.material) &amp;&amp; Objects.equals(this.guide, meal.guide);
      }
  
      @Override
      public int hashCode() {
          return Objects.hash(id, menuId, name, image, material, guide);
      }
  
      @Override
      public String toString() {
          StringBuilder sb = new StringBuilder();
          sb.append("class Meal {\n");
  
          sb.append("    id: ").append(toIndentedString(id)).append("\n");
          sb.append("    menuId: ").append(toIndentedString(menuId)).append("\n");
          sb.append("    name: ").append(toIndentedString(name)).append("\n");
          sb.append("    image: ").append(toIndentedString(image)).append("\n");
          sb.append("    material: ").append(toIndentedString(material)).append("\n");
          sb.append("    guide: ").append(toIndentedString(guide)).append("\n");
          sb.append("}");
          return sb.toString();
      }
  
      /**
       * Convert the given object to string with each line indented by 4 spaces
       * (except the first line).
       */
      private String toIndentedString(java.lang.Object o) {
          if (o == null) {
              return "null";
          }
          return o.toString().replace("\n", "\n    ");
      }
  }
  </code></pre>