index.js
function (db, entityName, doc, cb) {
			request.post({
				url: host + 'databases/' + db + '/docs',
				headers: {
					'Content-Type': 'application/json; charset=utf-8',
					'Raven-Entity-Name': entityName
				},
				body: JSON.stringify(doc)
			}, function (error, response, resBody) {
				if (!error && (response.statusCode === 201 || response.statusCode === 200)) {
					var result = JSON.parse(resBody);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function (db, entityName, doc, cb) {
			request.post({
				url: host + 'databases/' + db + '/docs',
				headers: {
					'Content-Type': 'application/json; charset=utf-8',
					'Raven-Entity-Name': entityName
				},
				body: JSON.stringify(doc)
			}, function (error, response, resBody) {
				if (!error && (response.statusCode === 201 || response.statusCode === 200)) {
					var result = JSON.parse(resBody);
					cb(null, result);
				} else {
					cb(error || new Error(response.statusCode), null);
				}
			});
		}
function ( db , entityName , doc , cb ) { request . post ( { url : host + 'databases/' + db + '/docs' , headers : { 'Content-Type' : 'application/json; charset=utf-8' , 'Raven-Entity-Name' : entityName } , body : JSON . stringify ( doc ) } , function ( error , response , resBody ) { if ( ! error && ( response . statusCode === 201 || response . statusCode === 200 ) ) { var result = JSON . parse ( resBody ) ; cb ( null , result ) ; } else { cb ( error || new Error ( response . statusCode ) , null ) ; } } ) ; }
Stores given document, returns raven generated id in callback.
@param {string} db
@param {string} entityName
@param {Object} doc
@param {Function} cb
Stores given document returns raven generated id in callback .