index.js
function (db, id, doc, metadata, cb) {
			var operations = [
				{
					Method: "PUT",
					Document: doc,
					Metadata: metadata,
					Key: id
				}
			];
			request.post({
				url: host + 'databases/' + db + '/bulk_docs',
				headers: {
					'Content-Type': 'application/json; charset=utf-8'
				},
				body: JSON.stringify(operations)
			}, function (error, response, resBody) {
				if (!error && response.statusCode === 200) {
					var result = JSON.parse(resBody);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function (db, id, doc, metadata, cb) {
			var operations = [
				{
					Method: "PUT",
					Document: doc,
					Metadata: metadata,
					Key: id
				}
			];
			request.post({
				url: host + 'databases/' + db + '/bulk_docs',
				headers: {
					'Content-Type': 'application/json; charset=utf-8'
				},
				body: JSON.stringify(operations)
			}, function (error, response, resBody) {
				if (!error && response.statusCode === 200) {
					var result = JSON.parse(resBody);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function ( db , id , doc , metadata , cb ) { var operations = [ { Method : "PUT" , Document : doc , Metadata : metadata , Key : id } ] ; request . post ( { url : host + 'databases/' + db + '/bulk_docs' , headers : { 'Content-Type' : 'application/json; charset=utf-8' } , body : JSON . stringify ( operations ) } , function ( error , response , resBody ) { if ( ! error && response . statusCode === 200 ) { var result = JSON . parse ( resBody ) ; cb ( null , result ) ; } else { cb ( error || new Error ( response . statusCode ) , null ) ; } } ) ; }
Overwrites given document with given id.
@param {string} db
@param {string} id
@param {Object} doc
@param {Object} metadata
@param {Function} cb
Overwrites given document with given id .