[英]Mongojack- how to create composite Primary key
We are using mongodb & MongoJack for mapping our collections. 我们正在使用mongodb和MongoJack映射我们的集合。 There is a need where we need to create composite primary key. 我们需要创建复合主键。 We are not getting correct configuration how to use @Id annotation. 我们没有正确配置如何使用@Id注释。
Can anyone help in this or should we avoid using mapper for the same? 任何人都可以帮忙,还是应该避免使用mapper?
MongoDB Composite Key link tells what we want to do . MongoDB Composite Key链接说明了我们要做什么。 But we want this through mongojack.. 但是我们想要通过mongojack ..
Below syntax should work. 下面的语法应该工作。 Note replacing String class with your Key class 注意将String类替换为Key类
private static JacksonDBCollection<Test, TestKey> coll = MongoDB.getCollection("test", Test.class, TestKey.class);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.