V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
m939594960
V2EX  ›  问与答

想问一下 nosql 关联数据存储于更新的问题

  •  
  •   m939594960 · Jan 9, 2019 · 1337 views
    This topic created in 2678 days ago, the information mentioned may be changed or developed.

    例如现在我有一个评论的需求,记录应该大概是这样的

    {
    	"id":"1111",
        "content":"好的",
        "user":{
        	"name":"hooklife",
            "avatar":"http://v2ex.com"
        }
    }
    

    如果要是采用这种存储的方式的话,当用户修改头像的时候,这些评论数据都需要更新,是不是非常的不科学?? 但是如果只存一个 user_id 的话又觉得和传统的关系数据库没有差别了,毕竟关系数据库也是合理的要冗余一些数据。

    2 replies    2019-01-30 13:00:39 +08:00
    hrH5KaH2t49cVPy2
        1
    hrH5KaH2t49cVPy2  
       Jan 30, 2019   ❤️ 1
    不太适合有关联的场景。
    m939594960
        2
    m939594960  
    OP
       Jan 30, 2019
    @cnlinjie #1 我感觉 web 应用中很多地方都要使用关联,有哪些场景比较适合使用 mongodb 呢?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3009 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 07:18 · PVG 15:18 · LAX 00:18 · JFK 03:18
    ♥ Do have faith in what you're doing.