diff --git a/document.js b/document.js index e5acb28..2f8d214 100644 --- a/document.js +++ b/document.js @@ -442,6 +442,8 @@ Document.prototype._saveContent = function(body) { for (key in body) { if (key === '_rev') { this._revision = body[key]; + } else if (key === '_id') { + this._id = body[key]; } else { this._body[key] = body[key]; } diff --git a/package.json b/package.json index 9f16a61..956fcd1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cushion", - "version": "1.6.2", + "version": "1.6.3", "description": "A CouchDB API for Node.js", "keywords": [ "couchdb" diff --git a/test/3-document-test.js b/test/3-document-test.js index f355fb4..7e34921 100644 --- a/test/3-document-test.js +++ b/test/3-document-test.js @@ -40,6 +40,8 @@ exports.tests = [{ 'url': ['PUT', config.database + '/' + config.document, {}], 'callback': function(error, document) { expect(document).to.be.an('object').and.to.have.property('_id'); + expect(document._body).to.be.an('object').and.to.not.have.property('_id'); + expect(document._body).to.be.an('object').and.to.not.have.property('_rev'); }, }, { 'message': 'load document',