caching - Couchdb conceptual problems -


as understand, update object couchdb. have send whole object since "inserting" new revision same id. neat , works quite well.

but have problem, i'm not sure how should handle that. have object can't sent user completely. have hide informations such password hash.

the data sent client, revision sent too. when try update object have 1 problem. since data missing, update erase attributes missing user.

that said, easiest way have object couchdb, check if id , rev matches. if match, merge object missing attributes. work pretty , can support deleting attributes too.

then using technique, add objects cache reduce time query frequent objects database. if object can updated, clear cache id. if object newer, i'll have handle error or merge object.

is there better "good way" handle problem?

edit

after thinking during night, think found much better solution. instead of having username , password inside profile. i'll separate identification object use profile.

in other words, i'll have split object as possible keep things isolated... on plus side, can add multiple authentication 1 profile without messing profile itself. can return profiles , necessary without returning secret object.

it complicate bit logic of insertion should quite easy...

  1. get 1 id couchdb using uuid api "_uuids"
  2. insert password authentications (username, password, profile_id) using uuid
  3. if succeed, insert profile using uuid got @ 1

if wrong happen, rollback , tell users what's wrong.

also nice thing method can add access_token oauth2 using profile id , logic same password, auth type differ auth type should work same.

yeah, extracting secret stuff profile documents sounds way go.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -