0

I'm creating a Spring Boot application and I am using AngularJS on the frontend.

Upon submitting a form with the appropiate parameters, Spring is supposed to use bookRepository.save() method in order to save the provided data in the MongoDB. The problem is, this action gets carried on, but the structure of my model is not respected.

@Document(collection = "books")
public class Book {
    private String id;

    private String title;

    private String author;

    private String description;

    private String cover;

    // Getters and setters below.
}

The final outcome after following the above process: instead of having a record following the above structure inserted in MongoDB, I only end up with a field containing _id and _class.

Any ideas as to why is this happening?

s7vr
  • 73,656
  • 11
  • 106
  • 127
Cristian D
  • 673
  • 5
  • 21
  • Can you add a sample document from collection and also the part of code where you are mapping the data to `Book` object ? – s7vr Feb 26 '17 at 01:38
  • please follow this tutorial https://spring.io/guides/gs/accessing-data-mongodb/ and check what you have missed to include in your app – Barath Feb 26 '17 at 06:02
  • Perhaps your object is empty (i.e. all fields are null). That would explain that behaviour. – Milan Milanov Feb 26 '17 at 20:37

0 Answers0