我是 CouchDB 和 Ektorp 的新手(我实际上是从今天开始尝试使用它)。我发现可以帮助我入门的最详细的文档是这个:
http://www.ektorp.org/reference_documentation.html#d100e394
我的用例是我想将一个非常复杂的类保存为文档(到目前为止我已经做到了),但我不想一直加载所有字段(因为其中一些可能是其他更简单的大集合文件)。
这是我所拥有的一个示例(它只是我用来学习使用 Ektorp 和 CouchDB 的实验课
@JsonSerialize(include = Inclusion.NON_NULL)
public class Player extends CouchDbDocument {
private int xp = 0;
@JsonDeserialize(using = CoinPouchDeserializer.class)
private CoinPouch coins = new CoinPouch(); // subclass of enumMap not
// complex
@DocumentReferences(backReference = "playerId", fetch = FetchType.LAZY, descendingSortOrder = true, orderBy = "itemid")
private Inventory inventory = new Inventory();// subclass of Map<String,
// Item> Items are document
// themselves
}
我设法保存它并通过 id 获取它就好了。但是如何在不加载库存的情况下获得它?
我也很感激任何指向其他资源的链接,我应该检查一下开始使用 couchdb 或 ektorp 和 java(或 scala),干杯。
感谢您提供任何有用的答案。