Adding support for append and prepend.

Change-Id: I6c8d5297ee4a89c8e6c6014b95558e0fb06a6eac
Reviewed-on: http://review.couchbase.org/40500
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>