I have a need to have one document which contains a nested document. The nested document contains a field for which I would like an index. Here is an example:
First Document:
What I would expect is the following index definition
db.logItems.ensureIndex({ "stackTrace.exceptionName" : 1 },{ "name" : "StacktraceExceptionNameIndex" });
The above is how I can do this in mongo shell.
I need a way to do this using spring-data and mongo
Thanks in advance
First Document:
Code:
@Entity
@Table(name="logItems")
public class LogItem {
@Id
private ObjectId id;
private String level;
private String message;
private StackTrace stackTrace;
.
.
.
}
@Document
public class StackTrace {
@Index
private string exceptionName;
private String[] stack;
.
.
.
}
db.logItems.ensureIndex({ "stackTrace.exceptionName" : 1 },{ "name" : "StacktraceExceptionNameIndex" });
The above is how I can do this in mongo shell.
I need a way to do this using spring-data and mongo
Thanks in advance