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 entitys 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

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -