java - Spring Data MongoDB index on recursive data structure -
imagine have following recursive structure in spring data mongodb:
@document public class entity{ @field private string name; @field private instant date; @field private list<entity> children; }
now let's want compound index on name
, date
field can do:
@document @compoundindexes({ @compoundindex(name = "name-date_idx", def = "{'name' : 1, 'date' : -1}", unique = true) }) public class entity
i want index apply top level entity
, not entity
s obtained derived children
field.
however spring creating index name-date_idx
, children.name-date_idx
indices.
how can have index @ top level , not children entities?
Comments
Post a Comment