MB-10711: Datatype detection for legacy clients

- In case of legacy clients that do not support
datatype, check whether document is of type JSON
and set the datatype as it should be, before the
saving the document.

Change-Id: I90e579e21bd35ce1b8d7ac4418135c9d92d04148
Reviewed-on: http://review.couchbase.org/35169
Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com>
Tested-by: Chiyoung Seo <chiyoung@couchbase.com>