From the course: Creating Your First Spring Boot Microservice

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Spring Data MongoDB documents

Spring Data MongoDB documents

From the course: Creating Your First Spring Boot Microservice

Start my 1-month free trial

Spring Data MongoDB documents

- [Instructor] Now we're going to see how our domain objects have changed. We're using MyId to compare two different branches. One is the five.N branch, which is the result of migrating to MongoDB and I'm comparing it to five-begin. So within the domain package, we see these files have changed. Let's dig into the TourPackage.java and we see that, in gray, things have been removed. In green, it's new. We don't use @Entity anymore. Now we use @Document. We continue to use @Id, but now it's using the springframework.data.annotation.Id instead of javax.persistence.Id. And we no longer use @Column on the name because there's no such thing as a column in MongoDB. Next, let's look at a Tour. It's a little more complicated here. So, again, we use @Entity no more. We now use @Document. Our @Id is for this ID attribute. And we don't need @Generated and we have changed the type of the ID to a string instead of an integer…

Contents