spring - How to remove unique index on nested Object in Mongo -
i using spring boot 2.0.0.m3. , have following object structure:
@document(collections="note") public class note { string id; @indexed(background=true,unique=true) string requestid; } @document(collection="noteexpression") public class noteexpression { public static class error { private datetime datetime = datetime.now(); private note note; private string exception; } string id; //some other fields error error; } in object of noteexpression, need store error information when unexpected occurs. seems fine. problem mongo create unique index nested property note in noteexpression.error.
see result of mongo command below:
>db.noteexpression.getindexes() [ { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "test.noteexpression" }, { "v" : 2, "unique" : true, "key" : { "errors.note.requestid" : 1 }, "name" : "errors.note.requestid", "ns" : "test.noteexpression", "background" : true } ] unique index requestid on documents of note necessary in system, don't want unique index on documents of noteexpression. there way avoid creating index on noteexpression?
Comments
Post a Comment