David Welch David Welch - 1 year ago 123
Java Question

SpringData Mongo @Column equivalent annotation (@Property?)

Is there a SpringData Mongo equivalent of the JPA @Column annotation?

Basically, I've got a POJO with a property that I want to store in Mongo with a different name. So, the following object:

public class Pojo{
private String foo = "Hello World";

would be persisted as:

"bar" : "Hello World"

Note: I don't want to use the
to explicitly do it

Answer Source

The Spring Data reference documentation lists @Field as the annotation to customize the key and ordering of properties mapped to a MongoDB document.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download