MongoDB - Maintain data integrity automatically -
i'm interested in migrating relational db mongodb performance improvements. storing redundant, denormalized data in multiple locations , wondering if possible automatically maintain integrity of data without application code.
for example, if have user document...
user: { _id: "...", username: "johndoe", displayname: "john doe", totaltasks: 3 } and task document...
task: { _id "...", title: "finish reports", userid: "...", username: "johndoe", userdiplayname: "john doe" } how can automatically ensure username , displayname stay same in appropriate documents? how can ensure totaltasks updated when new tasks added or deleted user?
you can't enforce these constraints on server side. triggers that's planned. constraint that's supported unique indexes.
Comments
Post a Comment