RavenDB - retrieving part of document

前端 未结 3 1977
深忆病人
深忆病人 2021-01-04 02:02

I am playing with Raven DB for few days and I would like to use it as a storage for my Web chat application. I have document which contains some user data and chat history -

3条回答
  •  离开以前
    2021-01-04 02:45

    Tomek, you cannot load only a part of the document.

    However, I understand the problem in your case. I recommend to use two seperate documents for each user: One that actually contains the users data (name, passwordhash, email, etc.) and one that contains all the users messages. That way, it is still very cheap to load all the messages of a user and also to load a list of user for general purposes.

    This is actually quite similar to how one would model a blog-domain, where you have a post and the posts comments. Take a look at RaccoonBlog to see how this works.

提交回复
热议问题