Write a Couchbase database driver. On the surface, Couchbase seems somewhat akin to MongoDB, so adapting the logic of that driver here might be a good jumping-off point.