Just started using Hood.ie - have a question with finding and updating data.
I have a type called 'who' within which i have stored a 'personId' and 'time'. What i want to do is search 'who' for 'personId' I specify then update record which is empty.
So i can do basic updates like
hoodie.store.update('whosin', clicked_id, { timeOut: Date() });
but how do i do the more complicated one with hood.ie as above - something roughly like:
hoodie.store.update('whosin', personID = clicked_id, { timeOut: Date() WHERE timeOut = "" });
If I understand you correctly, you want to set the
timeOut
property only if it's not set yet. You can achieve that by passing an updateFunction, see the 2nd example here: http://docs.hood.ie/en/techdocs/api/client/hoodie.store.html#storeupdateIn your case that would be