ID Transformation

Defaulted ID is “_id” in Mongodb, but we hope to show id when searching.

If you use deserialization when retrieving in MongoDB Plugin, just add “JSONField” to “set” method of “ID” field of “bean” object.

@JSONField(name = "_id")
public void setId(String id) {
    this.id = id;
}

It is worth noting that using Mongo Plugin to achieve own “join” query will automatically convert “_id” to “id”, which would cause that embedded document have no ID(Beause declared @JSONField(name = "_id"))

results matching ""

    No results matching ""