W3C home > Mailing lists > Public > public-webapps@w3.org > April to June 2010

Re: [IndexedDB] Changing the default overwrite behavior of Put

From: Nikunj Mehta <nikunj@o-micron.com>
Date: Wed, 16 Jun 2010 09:43:48 -0700
Cc: Shawn Wilsher <sdwilsh@mozilla.com>, public-webapps WG <public-webapps@w3.org>
Message-Id: <2A11B3E9-3925-4069-A93C-AE7630E86850@o-micron.com>
To: Kris Zyp <kris@sitepen.com>

On May 10, 2010, at 10:36 AM, Kris Zyp wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 5/7/2010 1:32 PM, Shawn Wilsher wrote:
>> Hey all,
>> 
>> Per the current spec [1], noOverwrite defaults to false for put
>> operations on an object store.  Ben Turner and I have been
>> discussing changing the default of put to not allow overwriting by
>> default.  We feel this is better behavior because simply omitting
>> the flag should not result in destroying data.  Putting my
>> application developer hat on, I'd much rather have to be explicit
>> about destroying existing data instead of having it happen on
>> accident.  We could also change the parameter to just overwrite and
>> have it default to false.
>> 
>> What is everyone's thoughts on this?
> 
> I believe there are three useful modes:
> overwrite: false - Must create a new record
> overwrite: true - Must overwrite/update an existing record
> (something else) - Create a new record or overwrite/update an existing
> (depending on the key of course).
> 

There are three theoretical modes as you say. However, the second mode does not exist in practice. If you must overwrite, then you know that the record exists and hence don't need to specify that option. 

I have two precedents to go by:
1. It is extremely rare that people call PUT with If-None-Match: * in HTTP.
2. Berkeley DB does not sport putMustOverwrite.

So, in summary, I agree to splitting the put method in to two - put and putNoOverwrite. I am also in favor of retaining the name as put (contrasted with get). I would like to avoid bikeshedding on names even though there have been ample opportunities on this list lately with that.

> I would prefer that the last option should be indicated by omission of
> the overwrite property (and thus be the default). I don't buy the
> destruction of data argument, prior art clearly suggests that "put"
> can alter existing data (unless you explicitly indicate otherwise).
> 
> Thanks,
> 
> - -- 
> Kris Zyp
> SitePen
> (503) 806-1841
> http://sitepen.com
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkvoRAAACgkQ9VpNnHc4zAxtPgCgnpmjx9aXWwS4SEPBegr6p9iI
> dsEAni3Yb9fbZRhdHxhYB+hVu5xhFwvo
> =UzZ9
> -----END PGP SIGNATURE-----
> 
> 
Received on Wednesday, 16 June 2010 16:44:22 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 18:49:39 GMT