{"_id":"couch-ar","_rev":"43-14de1361395579e42ef8a2cdb35d1d42","name":"couch-ar","description":"active record for CouchDB","dist-tags":{"latest":"0.3.4"},"versions":{"0.1.0":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.0","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.0","_nodeSupported":true,"_npmVersion":"0.2.10-1","_nodeVersion":"v0.2.4","dist":{"shasum":"a33124a08987e4e57e8a1100ed9b167c5c6d80bb","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.0.tgz","integrity":"sha512-e+U8JlyCX2Dfo4W3M9rNpU5CCplChb+JmE+x/Rmbw9ZyDwLtHAgh/UFQHg8sY+n5WUeW5NmycUu2VQ8q3UbHlw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDGNR3wJaBil7CA3fr6Lwaqwy2lpZuEgt6Y/0AQk8F+VAIgesjapKgRrWXXR8lcQuU8AFqCOxzWM2maAHwXAS52dCI="}]}},"0.1.1":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.1","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.1","_nodeSupported":true,"_npmVersion":"0.2.10-1","_nodeVersion":"v0.3.7","dist":{"shasum":"07eae507ce87334806f12490b85ca314ae666570","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.1.tgz","integrity":"sha512-yo6PY2EM0G0KYszpj7dzMAGeiEllINKPtdXpfrC2wmbJaWXtZv+62q3VsP+IlCMnuHtFpeW24BGHrp9lmhvsIg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCIdNAljFUXy0AlkTCc400O4WNbzR3u/RCo7eTMtvM7rQIgLZhkc9WOrIErR1w++rH2Jx71zkzJJ/Kv1vcxxj4qiKY="}]}},"0.1.2":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.2","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.2","_nodeSupported":true,"_npmVersion":"0.2.10-1","_nodeVersion":"v0.4.1","dist":{"shasum":"7b13ac4ef5a0595db1d962a1867cae39f8f25b04","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.2.tgz","integrity":"sha512-/4SZ9N5KEs50dCmOHNu8nmILXX+s/qNVqzx1bkISHLiP99SAOJD8+J0s6xfvAyL/zV+cL5IPjdyn48RzJqEAiw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDz1rTWpzapa/d5COjacsbO6urXc0x6Y++eeM+gTxzjQIhAKJ/Bc9W6nZwNmndUvtx6jAAqL+X2Hntaf3yelEbaj9p"}]}},"0.1.3":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.3","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.3","_nodeSupported":true,"_npmVersion":"0.2.10-1","_nodeVersion":"v0.4.1","dist":{"shasum":"41d44d58a7311eaefe537a2170bd413265a330fb","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.3.tgz","integrity":"sha512-nP9/E8rVJ+5+c4dMPSjGP5rSDE9iQeW/U+4gy7cGyBiu/5mUbwJ29lK6v1L4esw6bQ8wGrn0IXh0CcfDTJcrvg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIH47QHAcKcsQr/UaZdskablWK02uBTVOtWKQXgGo8cvaAiEA1mwpi+kIzrnZcl7WSLtNHtIuM+x+Hr7tmuoGJr6lb+c="}]}},"0.1.4":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.4","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.4","_nodeSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.4.1","dist":{"shasum":"2a2859802db08151ff10d8b427d0b5f4c28cd944","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.4.tgz","integrity":"sha512-ol1+XJvMnrYxt7vwatUAnZx44NENsXLsUeWZmwWH5tzN/yepoFRLoi4DjfGZDx7fhCi7WDmFbZ201v45W9cdMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDaEbeVdaPtChDQDOdDa7khSpl3MVHuyNLzehCZAJEI2wIhANzkWroay32vSbiemdJ16kG27QXgivHTUn9pXGUZL6Aa"}]},"_engineSupported":true,"files":[""],"_defaultsLoaded":true},"0.1.5":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.5","homepage":"https://github.com/scottburch/couch-ar","author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"lib":""},"main":"./","engines":{"node":"*"},"_id":"couch-ar@0.1.5","_nodeSupported":true,"_npmVersion":"0.3.9","_nodeVersion":"v0.4.1","dist":{"shasum":"4a57d190473bf7c22e74cd767a984075e2bccca8","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.5.tgz","integrity":"sha512-XAP3kzAkLt94jn728A2hXmbkWmUPvJJlM0IOT0MqcIX/7VgQRlxZLjOYBGNOIe67pZEjubjxelgK9waO55Ejrw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD07MgqiJELH449FSot5jwHWzUc/R00utNJKU7BhBIT9gIgdwx+GTvplWRW5tXuklnS+4ABJzuBs+RuxzfuZgOCud8="}]},"_engineSupported":true,"files":[""],"_defaultsLoaded":true},"0.1.6":{"name":"couch-ar","description":"active record for CouchDB","version":"0.1.6","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.1.6","_nodeSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.8","dist":{"shasum":"250b834accdeb7ce928af6c16f18ba2a4f298515","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.1.6.tgz","integrity":"sha512-MKUXMTf0+f0QzTWe29Im+Yhh9YdiFB4xrW4A/VVhpoBoQIR+NK1XRVXNqNBRjHCLerNiZcFti4hMtI5Yc3juTA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBMn4xAhh6f4yatnrr6Dny3NpgkDfSk75kzLMSRyRNtdAiAaG74KA0XcSk77DgWq3pw3cjA2bv5e3T4ewv33iryK7w=="}]},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"scripts":{}},"0.2.0":{"name":"couch-ar","description":"active record for CouchDB","version":"0.2.0","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.2.0","_nodeSupported":true,"_npmVersion":"1.0.6","_nodeVersion":"v0.4.10","dist":{"shasum":"943db8fee1c64f997369fc8fac81cca51ccd6fe9","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.2.0.tgz","integrity":"sha512-4GeB7x1MTEWK9QBip3Ww/HhLmhVbF8mcI4c9j17Rhl2DWDtHnGyMrjzBLTs8gjYv7OPadN3BhOTFmtpSPrdTBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCLXZ6y/QWTkLv7LG9VpnjflfFRNpyvevp0TmNFofBtkgIhAM+1JGJK4ecRSKVoeVgAIcWKxznQL195jKT8CWRzhFXL"}]},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"scripts":{},"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.2.2":{"name":"couch-ar","description":"active record for CouchDB","version":"0.2.2","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.2.2","_nodeSupported":true,"_npmVersion":"1.0.99","_nodeVersion":"v0.4.12","dist":{"shasum":"c8b6ee9458881c9f8778d59e9b41176ba2087acf","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.2.2.tgz","integrity":"sha512-cU3IjCXlF70VE3cwEX9kXbTOJFXPVMEePWYNDekGu2oiJ0jAL4RYRp6BLIALnXX5kf7RQcWD2ElkspqY9Rwrzw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBWHBW+B2q809oYzlDGqVJQLc6uw7yOtJXSOZUVbM2E0AiB57nDzCPnUhFyTUZ0RLZEJHVFdO4Y23G9jb9yyDiekYQ=="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.2.3":{"name":"couch-ar","description":"active record for CouchDB","version":"0.2.3","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.2.3","_nodeSupported":true,"_npmVersion":"1.0.99","_nodeVersion":"v0.4.12","dist":{"shasum":"60cbad80d1733a0ef4340029c50d7b908329157d","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.2.3.tgz","integrity":"sha512-yLI7fbqFHXt+/SJY2RM+gmDeWES4HxXYc2HXfw69lZFd6a+nUkjyS1BYBVsohbDjWkfjMRjupAcqIo1rC9memA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHClrpDET0ScIpu63+BLIEu6eQN+A4k5V58fe/hMh516AiBLA0duvlH/S/UFfxPGkWlZ0uDXwu4Rg6Krrcwv4fQ62Q=="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.2.4":{"name":"couch-ar","description":"active record for CouchDB","version":"0.2.4","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.2.4","_nodeSupported":true,"_npmVersion":"1.0.99","_nodeVersion":"v0.4.12","dist":{"shasum":"debe7175036d72b5a7409be4cc221c6752bf50e5","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.2.4.tgz","integrity":"sha512-vF/aHXtW7q90LDjkIRwJWt0Jdo/ANAYEjcQtN0rMJreQ+P/JT31xpjPaR9FcF+astujR1O7J+2IhV1WedAFyYA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCKmlH3D5JxYhfs9fVluyFOl/HaMZBEJrP45wLztv7iQwIgNpMh5ubq/aO58cFyEHp13VROWY5OO1xE/3hGMLl2bCE="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.2.5":{"name":"couch-ar","description":"active record for CouchDB","version":"0.2.5","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.2.5","_nodeSupported":true,"_npmVersion":"1.0.99","_nodeVersion":"v0.4.12","dist":{"shasum":"afcd42fbaa41f6bc959fb9757c19c1778ec706f3","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.2.5.tgz","integrity":"sha512-9MMBlPR1A7tBIuTZ+XCY9ZwTQW4sJ5zUgZNPEQity+oU/QrhABwuXkw1sVQD+o/FtFRIYVxQR8mYHVE1/Lpf9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCl98eJkbDTX+MbWANj0vNzDJhRcIrH7SbSsiohjtPMRwIhAMjGQ7tZmnZIwO4veurR3N49Mp73y9smqFN/LWNO5naq"}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.3.1":{"name":"couch-ar","description":"active record for CouchDB","version":"0.3.1","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.3.1","_nodeSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.9","dist":{"shasum":"86f19734af0a2763ad3751ea69ce9ab169e91f95","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.3.1.tgz","integrity":"sha512-OBCGOnaTFLOERx+cA2Mtzr8IoLY/mEU/6Z6c8/r2ODVm7P3FgDcDAOn0qcLCWyDRl8z4wGlu0PUDd/8C2VO1gQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGBrivyR8FrURLsWvhnYOBf1S6RaqnApDAx4mpkTi1IfAiAXmIbkXq4Gfy7pRmr+lMiMfO2lFZd1lND9QjdWuGs1Lg=="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"readme":"# couch-ar is a thin active record implementation for couchDB\n\n## Important Note\nPrevious versions of couch-ar included a bug that would cause the domain constructor finder methods not to work if you restarted the server.\nThis appears to be due to a bug in newer versions of CouchDB.  I am not sure when it appeared, but I have modified the code to deal with it.\n\n## Motivation\n\n The idea behind couch-ar is to provide an easy to use active record\n implementation while  keeping the speed of node.js.  For this reason\n couch-ar does not add a lot of abstraction.  My aim is to provide an\n easy way to have full domain constructors while writing only the\n required information to the db document.\n\n Domain constructors are defined in advance with couch-ar\n in a simple format that includes a list of properties to write to the DB.\n\n Please feel free to write with any comments or suggestions: scott@bulldoginfo.com\n\n## Installation\n\nnpm install cradle (this is a dependency)\n\nnpm install couch-ar\n\nNOTE: We also use 'fs'\n\n## Quickstart\n\nThere is a quick example in the example directory. This is also a good way to see if you have everything setup correctly.\n\n    cd example\n    node example\n\nThe example does not contain all of the functions.  Just basic save/read/remove.\nIt is recommended that you read the 'How to use' section to get more detail.\n\nThe most complete way to see how it works is to examine and run the included tests.\n    cd to test\n    ./specs.sh\n\nThe tests are written using jasmine-node.\nFor information on how to run the tests using this module, please refer\nto the jasmin-node documentation.  I have included only enough to run the\ntests.\n\n## How to use\n\nThe first step is to run the init method to generate the database and read\nyour domain files.\n\n        require('couch-ar').init({\n            dbName: 'couch-ar-test',                    // The database name - couch-ar will create the database\n            root: __dirname + '../testDomain'           // The root of the domain constructors\n            host: 'myHost'                              // (optional) The hostname\n            port: 9999                                  // (optional) The port\n            connectionOptions: {}                       // (optional) Cradle config options\n        }, function(db){ // passes back the cradle connection });\n\nNext, create your domain files in ../testDomain like this:\n\n    var domain = require('couch-ar');\n    domain.create('TestUser',{\n        dbName: 'couch-ar-test',                          // Optional - choose the db to use for this domain constructor\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n            fullName: {}\n        },\n        hasMany: {\n            phoneNumbers: 'PhoneNumber',\n            children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    }, function(that) {\n        this.beforeSave = function() {\n            that.fullName = that.firstName + ' ' + that.lastName;\n        }\n        return that;\n    });\n\n\n## Constructor\n\nDomain definitions can contain a constructor function as an argument.  'this' in constructor functions points to the instantiated object itself so that you can\nuse the constructor function to modify the instantiated object or the provided 'that' argument.\n\nI am using Douglas Crockford's parasitic inheritance and power constructors.\nTo understand my code it is best to understand this style.\n\nAfter running init() the domain constructors are available from the couch-ar object.\n\n    var domain = require('couch-ar');\n    domain.TestUser.create({}) or domain['my-db-name'].TestUser.create({})\n\n\n## Before Hooks\n\ndomain constructors can include a hook beforeSave() that will be run before a document\nis saved or updated in the DB.\n\n\n## create()\n\ncouch-ar adds a static factory for constructing domain objects using a parameter map.\nSimply call Domain.create({}) passing a map of parameters to add to the object.  \n\nexample:\n    domain.TestUser.create({username:'me'})\n\n\n## save()\n\nSaves or updates an existing document.\n\n     user.save(function(err, res){  })\n\n\n## remove()\n\nRemoves a document from the DB:\n\n    user.remove(function(err, res) {});\n\n\n## list()\n\nList all documents\n\n   domain.TestUser.list(function(users){});\n\n\n## findByXxx() / findAllByXxx()\n\nEvery property gets a findBy or findAllBy method.  The usage is pretty simple:\n\n    domain.TestUser.findAllByUsername('scott', function(users){ // passed the user objects })\n    domain.TestUser.findById('xxxxxx', function(user){})\n\n\nfindAllByXxx() can find documents in a range by passing an array as the value with the start and end keys\n\n    domain.TestUser.findAllByUsername(['a','aZ'], function(users) { // passed the user objects where username starts with 'a'})\n\n\n## addView()\n\nYou can also add views after a domain constructor is initialized by using the addView() method\n\n    var view = {\n           map: function(doc) {\n                    emit(doc.firstName + ':' + doc.lastName, doc);\n                }\n            }\n\n    function callbqack(){}\n\n    domain.TestUser.addView('lastAndFirstName', view, callback);\n\nAfter that the view is available as finders just like any other view\n\n    domain.TestUser.findAllByFirstAndLastName('Scott:Burch', function(users) {})\n    domain.TestUser.findByFirstAndLastName('Scott:Burch', function(user) {})\n\n\n## properties\n\nid = the DB id\n\nrev = the DB revision\n\ndateCreated = the date the object was first saved to the DB\n\nlastUpdated = the date the object was last updated\n\n## constructor properties\n\nviewNames = the list of view names\n\n## custom views\n\nYou can also add custom views to any domain constructor\n\nThe following example will create a view to find a user by first or last name:\n\n    domain.create('TestUser',{\n        dbName: 'my-db'\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n        },\n        hasMany: {\n           phoneNumbers: 'PhoneNumber',\n           children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    });\n\nThis code will also add static finders:\n\n    domain.TestUser.findAllByFirstOrLastName('Test',function() {});\n    domain.TestUser.findByFirstOrLastName('Tester',function() {});\n\n\n## Associations\n\ncouch-ar now supports hasMany associations.  To define a hasMany association pass a __hasMany__ in the config as shown above.\nThe value 'PhoneNumber' and 'Child' is a previously defined model.\n\nWhen you only supply a string then the singular names will be converted by chopping the 's' off the end.\nThe result is three new methods.\n\nAssuming the hasMany definition above the result will be 6 methods:\n\n* __addPhoneNumber(pn)__\n* __getPhoneNumbers(callback)__\n* __removePhoneNumber(pn)__\n* __addChild(c)__\n* __getChildren(callback)__\n* __removeChild(c)__\n\nthe add and remove can take a phone number directly. However, getters requires a callback which will be passed the result.\nThe items passed to add and remove must be persisted before trying to add or remove them.\n\n\n\n\n## License\n\nProvided under the MIT license.  In other words, do what you want with it.\n\n","maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.3.2":{"name":"couch-ar","description":"active record for CouchDB","version":"0.3.2","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.3.2","_nodeSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.9","dist":{"shasum":"4163ad3d17f5db8face17835c155798c9c620a18","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.3.2.tgz","integrity":"sha512-vMN30q8yUaFrLAFNmhF59KfxRf8mtX2JKDA5ZYjLg9bVa3YE7Uh6Pth30OHIDI4OZwnticzzyw/1i4QCNXrS6Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIF/945Z5OjIPNtWVbvsDzaUwkCZaVqgSpG2XeqO5VaO1AiBe9tHcvySg5IuwgLBhbORqwmjrcZ6vTCDmoDNikhGAow=="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"readme":"# couch-ar is a thin active record implementation for couchDB\n\n## Important Note\nPrevious versions of couch-ar included a bug that would cause the domain constructor finder methods not to work if you restarted the server.\nThis appears to be due to a bug in newer versions of CouchDB.  I am not sure when it appeared, but I have modified the code to deal with it.\n\n## Motivation\n\n The idea behind couch-ar is to provide an easy to use active record\n implementation while  keeping the speed of node.js.  For this reason\n couch-ar does not add a lot of abstraction.  My aim is to provide an\n easy way to have full domain constructors while writing only the\n required information to the db document.\n\n Domain constructors are defined in advance with couch-ar\n in a simple format that includes a list of properties to write to the DB.\n\n Please feel free to write with any comments or suggestions: scott@bulldoginfo.com\n\n## Installation\n\nnpm install cradle (this is a dependency)\n\nnpm install couch-ar\n\nNOTE: We also use 'fs'\n\n## Quickstart\n\nThere is a quick example in the example directory. This is also a good way to see if you have everything setup correctly.\n\n    cd example\n    node example\n\nThe example does not contain all of the functions.  Just basic save/read/remove.\nIt is recommended that you read the 'How to use' section to get more detail.\n\nThe most complete way to see how it works is to examine and run the included tests.\n    cd to test\n    ./specs.sh\n\nThe tests are written using jasmine-node.\nFor information on how to run the tests using this module, please refer\nto the jasmin-node documentation.  I have included only enough to run the\ntests.\n\n## How to use\n\nThe first step is to run the init method to generate the database and read\nyour domain files.\n\n        require('couch-ar').init({\n            dbName: 'couch-ar-test',                    // The database name - couch-ar will create the database\n            root: __dirname + '../testDomain'           // The root of the domain constructors\n            host: 'myHost'                              // (optional) The hostname\n            port: 9999                                  // (optional) The port\n            connectionOptions: {}                       // (optional) Cradle config options\n        }, function(db){ // passes back the cradle connection });\n\nNext, create your domain files in ../testDomain like this:\n\n    var domain = require('couch-ar');\n    domain.create('TestUser',{\n        dbName: 'couch-ar-test',                          // Optional - choose the db to use for this domain constructor\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n            fullName: {finders:false}                   // Turns off the creation of finders (findByXXX) for this property\n        },\n        hasMany: {\n            phoneNumbers: 'PhoneNumber',\n            children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    }, function(that) {\n        this.beforeSave = function() {\n            that.fullName = that.firstName + ' ' + that.lastName;\n        }\n        return that;\n    });\n\n\n## Constructor\n\nDomain definitions can contain a constructor function as an argument.  'this' in constructor functions points to the instantiated object itself so that you can\nuse the constructor function to modify the instantiated object or the provided 'that' argument.\n\nI am using Douglas Crockford's parasitic inheritance and power constructors.\nTo understand my code it is best to understand this style.\n\nAfter running init() the domain constructors are available from the couch-ar object.\n\n    var domain = require('couch-ar');\n    domain.TestUser.create({}) or domain['my-db-name'].TestUser.create({})\n\n\n## Before Hooks\n\ndomain constructors can include a hook beforeSave() that will be run before a document\nis saved or updated in the DB.\n\n\n## create()\n\ncouch-ar adds a static factory for constructing domain objects using a parameter map.\nSimply call Domain.create({}) passing a map of parameters to add to the object.  \n\nexample:\n    domain.TestUser.create({username:'me'})\n\n\n## save()\n\nSaves or updates an existing document.\n\n     user.save(function(err, res){  })\n\n\n## remove()\n\nRemoves a document from the DB:\n\n    user.remove(function(err, res) {});\n\n\n## list()\n\nList all documents\n\n   domain.TestUser.list(function(users){});\n\n\n## findByXxx() / findAllByXxx()\n\nEvery property that does not have a \"finders:false\" in it's config gets a findBy or findAllBy method.  The usage is pretty simple:\n\n    domain.TestUser.findAllByUsername('scott', function(users){ // passed the user objects })\n    domain.TestUser.findById('xxxxxx', function(user){})\n\n\nfindAllByXxx() can find documents in a range by passing an array as the value with the start and end keys\n\n    domain.TestUser.findAllByUsername(['a','aZ'], function(users) { // passed the user objects where username starts with 'a'})\n\n\n## addView()\n\nYou can also add views after a domain constructor is initialized by using the addView() method\n\n    var view = {\n           map: function(doc) {\n                    emit(doc.firstName + ':' + doc.lastName, doc);\n                }\n            }\n\n    function callbqack(){}\n\n    domain.TestUser.addView('lastAndFirstName', view, callback);\n\nAfter that the view is available as finders just like any other view\n\n    domain.TestUser.findAllByFirstAndLastName('Scott:Burch', function(users) {})\n    domain.TestUser.findByFirstAndLastName('Scott:Burch', function(user) {})\n\n\n## properties\n\nid = the DB id\n\nrev = the DB revision\n\ndateCreated = the date the object was first saved to the DB\n\nlastUpdated = the date the object was last updated\n\n## constructor properties\n\nviewNames = the list of view names\n\n## custom views\n\nYou can also add custom views to any domain constructor\n\nThe following example will create a view to find a user by first or last name:\n\n    domain.create('TestUser',{\n        dbName: 'my-db'\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n        },\n        hasMany: {\n           phoneNumbers: 'PhoneNumber',\n           children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    });\n\nThis code will also add static finders:\n\n    domain.TestUser.findAllByFirstOrLastName('Test',function() {});\n    domain.TestUser.findByFirstOrLastName('Tester',function() {});\n\n\n## Associations\n\ncouch-ar now supports hasMany associations.  To define a hasMany association pass a __hasMany__ in the config as shown above.\nThe value 'PhoneNumber' and 'Child' is a previously defined model.\n\nWhen you only supply a string then the singular names will be converted by chopping the 's' off the end.\nThe result is three new methods.\n\nAssuming the hasMany definition above the result will be 6 methods:\n\n* __addPhoneNumber(pn)__\n* __getPhoneNumbers(callback)__\n* __removePhoneNumber(pn)__\n* __addChild(c)__\n* __getChildren(callback)__\n* __removeChild(c)__\n\nthe add and remove can take a phone number directly. However, getters requires a callback which will be passed the result.\nThe items passed to add and remove must be persisted before trying to add or remove them.\n\n\n\n\n## License\n\nProvided under the MIT license.  In other words, do what you want with it.\n\n","maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.3.3":{"name":"couch-ar","description":"active record for CouchDB","version":"0.3.3","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.5.5"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.3.3","_nodeSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.9","dist":{"shasum":"83d1d32a3fcd445384a80f37466da7eee42f4d47","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.3.3.tgz","integrity":"sha512-V8k/I8bmPpzpvoGJidk8g0e6iuGBvI8h8L3amFX8A0jhzqA/Y9oJPDgWYdH5sOm0vTBdXTbpvTOxsG5PgiGMeQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICiF0YqmBzMIlKVduUCODK+B0otz2dS2ysXPJSmHX4DaAiEAkeaYMrdEqqy5LEAfsXTuY82agStl0F238f9z/af0nCM="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"readme":"# couch-ar is a thin active record implementation for couchDB\n\n## Important Note\nPrevious versions of couch-ar included a bug that would cause the domain constructor finder methods not to work if you restarted the server.\nThis appears to be due to a bug in newer versions of CouchDB.  I am not sure when it appeared, but I have modified the code to deal with it.\n\n## Motivation\n\n The idea behind couch-ar is to provide an easy to use active record\n implementation while  keeping the speed of node.js.  For this reason\n couch-ar does not add a lot of abstraction.  My aim is to provide an\n easy way to have full domain constructors while writing only the\n required information to the db document.\n\n Domain constructors are defined in advance with couch-ar\n in a simple format that includes a list of properties to write to the DB.\n\n Please feel free to write with any comments or suggestions: scott@bulldoginfo.com\n\n## Installation\n\nnpm install cradle (this is a dependency)\n\nnpm install couch-ar\n\nNOTE: We also use 'fs'\n\n## Quickstart\n\nThere is a quick example in the example directory. This is also a good way to see if you have everything setup correctly.\n\n    cd example\n    node example\n\nThe example does not contain all of the functions.  Just basic save/read/remove.\nIt is recommended that you read the 'How to use' section to get more detail.\n\nThe most complete way to see how it works is to examine and run the included tests.\n    cd to test\n    ./specs.sh\n\nThe tests are written using jasmine-node.\nFor information on how to run the tests using this module, please refer\nto the jasmin-node documentation.  I have included only enough to run the\ntests.\n\n## How to use\n\nThe first step is to run the init method to generate the database and read\nyour domain files.\n\n        require('couch-ar').init({\n            dbName: 'couch-ar-test',                    // The database name - couch-ar will create the database\n            root: __dirname + '../testDomain'           // The root of the domain constructors\n            host: 'myHost'                              // (optional) The hostname\n            port: 9999                                  // (optional) The port\n            connectionOptions: {}                       // (optional) Cradle config options\n        }, function(db){ // passes back the cradle connection });\n\nNext, create your domain files in ../testDomain like this:\n\n    var domain = require('couch-ar');\n    domain.create('TestUser',{\n        dbName: 'couch-ar-test',                          // Optional - choose the db to use for this domain constructor\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n            fullName: {finders:false}                   // Turns off the creation of finders (findByXXX) for this property\n        },\n        hasMany: {\n            phoneNumbers: 'PhoneNumber',\n            children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    }, function(that) {\n        this.beforeSave = function() {\n            that.fullName = that.firstName + ' ' + that.lastName;\n        },\n        that.afterSave = function(res, callback) {\n            // do something and callback with (err, res)\n            callback(undefined, res);\n        };\n\n        return that;\n    });\n\n\n## Constructor\n\nDomain definitions can contain a constructor function as an argument.  'this' in constructor functions points to the instantiated object itself so that you can\nuse the constructor function to modify the instantiated object or the provided 'that' argument.\n\nI am using Douglas Crockford's parasitic inheritance and power constructors.\nTo understand my code it is best to understand this style.\n\nAfter running init() the domain constructors are available from the couch-ar object.\n\n    var domain = require('couch-ar');\n    domain.TestUser.create({}) or domain['my-db-name'].TestUser.create({})\n\n\n## Before Hooks\n\ndomain constructors can include a hook beforeSave() that will be run before a document\nis saved or updated in the DB.\n\n## After Hooks\n\ndomain constructors can include a hook afterSave(res, cb) that will run after a document is saved.  See the previous example for the format.\n\n\n## create()\n\ncouch-ar adds a static factory for constructing domain objects using a parameter map.\nSimply call Domain.create({}) passing a map of parameters to add to the object.  \n\nexample:\n    domain.TestUser.create({username:'me'})\n\n\n## save()\n\nSaves or updates an existing document.\n\n     user.save(function(err, res){  })\n\n\n## remove()\n\nRemoves a document from the DB:\n\n    user.remove(function(err, res) {});\n\n\n## list()\n\nList all documents\n\n   domain.TestUser.list(function(users){});\n\n\n## findByXxx() / findAllByXxx()\n\nEvery property that does not have a \"finders:false\" in it's config gets a findBy or findAllBy method.  The usage is pretty simple:\n\n    domain.TestUser.findAllByUsername('scott', function(users){ // passed the user objects })\n    domain.TestUser.findById('xxxxxx', function(user){})\n\n\nfindAllByXxx() can find documents in a range by passing an array as the value with the start and end keys\n\n    domain.TestUser.findAllByUsername(['a','aZ'], function(users) { // passed the user objects where username starts with 'a'})\n\n\n## addView()\n\nYou can also add views after a domain constructor is initialized by using the addView() method\n\n    var view = {\n           map: function(doc) {\n                    emit(doc.firstName + ':' + doc.lastName, doc);\n                }\n            }\n\n    function callbqack(){}\n\n    domain.TestUser.addView('lastAndFirstName', view, callback);\n\nAfter that the view is available as finders just like any other view\n\n    domain.TestUser.findAllByFirstAndLastName('Scott:Burch', function(users) {})\n    domain.TestUser.findByFirstAndLastName('Scott:Burch', function(user) {})\n\n\n## properties\n\nid = the DB id\n\nrev = the DB revision\n\ndateCreated = the date the object was first saved to the DB\n\nlastUpdated = the date the object was last updated\n\n## constructor properties\n\nviewNames = the list of view names\n\n## custom views\n\nYou can also add custom views to any domain constructor\n\nThe following example will create a view to find a user by first or last name:\n\n    domain.create('TestUser',{\n        dbName: 'my-db'\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n        },\n        hasMany: {\n           phoneNumbers: 'PhoneNumber',\n           children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    });\n\nThis code will also add static finders:\n\n    domain.TestUser.findAllByFirstOrLastName('Test',function() {});\n    domain.TestUser.findByFirstOrLastName('Tester',function() {});\n\n\n## Associations\n\ncouch-ar now supports hasMany associations.  To define a hasMany association pass a __hasMany__ in the config as shown above.\nThe value 'PhoneNumber' and 'Child' is a previously defined model.\n\nWhen you only supply a string then the singular names will be converted by chopping the 's' off the end.\nThe result is three new methods.\n\nAssuming the hasMany definition above the result will be 6 methods:\n\n* __addPhoneNumber(pn)__\n* __getPhoneNumbers(callback)__\n* __removePhoneNumber(pn)__\n* __addChild(c)__\n* __getChildren(callback)__\n* __removeChild(c)__\n\nthe add and remove can take a phone number directly. However, getters requires a callback which will be passed the result.\nThe items passed to add and remove must be persisted before trying to add or remove them.\n\n\n\n\n## License\n\nProvided under the MIT license.  In other words, do what you want with it.\n\n","maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]},"0.3.4":{"name":"couch-ar","description":"active record for CouchDB","version":"0.3.4","homepage":"https://github.com/scottburch/couch-ar","dependencies":{"cradle":">=0.6.3"},"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"directories":{"test":"./test"},"main":"./couch-ar","engines":{"node":">=0.4.7"},"_id":"couch-ar@0.3.4","_nodeSupported":true,"_npmVersion":"1.1.0-3","_nodeVersion":"v0.6.9","dist":{"shasum":"d1cebe01c9955537b132b35a6b013996dee3107e","tarball":"https://registry.npmjs.org/couch-ar/-/couch-ar-0.3.4.tgz","integrity":"sha512-iCRXqutOirKIj8noduS+PdkTvQin4E0m9TkH2JclPP7rrLRrVBvbuEk6yIir9lcc7+B2ZPzH5jHftxQ8+gmQ4A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDoVqU/yMKgj7Mvf5nbQAq/YBYy+gQRKU4YlJyBG02bqAIgdzyKNqh9e6e3elFT+s/d24o5cYqnuleZa7Nc1MM8p3g="}]},"_npmUser":{"name":"scottburch","email":"scott@bulldoginfo.com"},"devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_defaultsLoaded":true,"readme":"# couch-ar is a thin active record implementation for couchDB\n\n## Motivation\n\n The idea behind couch-ar is to provide an easy to use active record\n implementation while  keeping the speed of node.js.  For this reason\n couch-ar does not add a lot of abstraction.  My aim is to provide an\n easy way to have full domain constructors while writing only the\n required information to the db document.\n\n Domain constructors are defined in advance with couch-ar\n in a simple format that includes a list of properties to write to the DB.\n\n Please feel free to write with any comments or suggestions: scott@bulldoginfo.com\n\n## Installation\n\nnpm install cradle (this is a dependency)\n\nnpm install couch-ar\n\nNOTE: We also use 'fs'\n\n## Quickstart\n\nThere is a quick example in the example directory. This is also a good way to see if you have everything setup correctly.\n\n    cd example\n    node example\n\nThe example does not contain all of the functions.  Just basic save/read/remove.\nIt is recommended that you read the 'How to use' section to get more detail.\n\nThe most complete way to see how it works is to examine and run the included tests.\n    cd to test\n    ./specs.sh\n\nThe tests are written using jasmine-node.\nFor information on how to run the tests using this module, please refer\nto the jasmin-node documentation.  I have included only enough to run the\ntests.\n\n## How to use\n\nThe first step is to run the init method to generate the database and read\nyour domain files.\n\n        require('couch-ar').init({\n            dbName: 'couch-ar-test',                    // The database name - couch-ar will create the database\n            root: __dirname + '../testDomain'           // The root of the domain constructors\n            host: 'myHost'                              // (optional) The hostname\n            port: 9999                                  // (optional) The port\n            connectionOptions: {}                       // (optional) Cradle config options\n        }, function(db){ // passes back the cradle connection });\n\nNext, create your domain files in ../testDomain like this:\n\n    var domain = require('couch-ar');\n    domain.create('TestUser',{\n        dbName: 'couch-ar-test',                          // Optional - choose the db to use for this domain constructor\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n            fullName: {finders:false}                   // Turns off the creation of finders (findByXXX) for this property\n        },\n        hasMany: {\n            phoneNumbers: 'PhoneNumber',\n            children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    }, function(that) {\n        this.beforeSave = function() {\n            that.fullName = that.firstName + ' ' + that.lastName;\n        },\n        that.afterSave = function(res, callback) {\n            // do something and callback with (err, res)\n            callback(undefined, res);\n        };\n\n        return that;\n    });\n\n\n## Constructor\n\nDomain definitions can contain a constructor function as an argument.  'this' in constructor functions points to the instantiated object itself so that you can\nuse the constructor function to modify the instantiated object or the provided 'that' argument.\n\nI am using Douglas Crockford's parasitic inheritance and power constructors.\nTo understand my code it is best to understand this style.\n\nAfter running init() the domain constructors are available from the couch-ar object.\n\n    var domain = require('couch-ar');\n    domain.TestUser.create({}) or domain['my-db-name'].TestUser.create({})\n\n\n## Before Hooks\n\ndomain constructors can include a hook beforeSave() that will be run before a document\nis saved or updated in the DB.\n\n## After Hooks\n\ndomain constructors can include a hook afterSave(res, cb) that will run after a document is saved.  See the previous example for the format.\n\n\n## create()\n\ncouch-ar adds a static factory for constructing domain objects using a parameter map.\nSimply call Domain.create({}) passing a map of parameters to add to the object.  \n\nexample:\n    domain.TestUser.create({username:'me'})\n\n\n## save()\n\nSaves or updates an existing document.\n\n     user.save(function(err, res){  })\n\n\n## remove()\n\nRemoves a document from the DB:\n\n    user.remove(function(err, res) {});\n\n\n## list()\n\nList all documents\n\n   domain.TestUser.list(function(users){});\n\n\n## findByXxx() / findAllByXxx()\n\nEvery property that does not have a \"finders:false\" in it's config gets a findBy or findAllBy method.  The usage is pretty simple:\n\n    domain.TestUser.findAllByUsername('scott', function(users){ // passed the user objects })\n    domain.TestUser.findById('xxxxxx', function(user){})\n\n\nfindAllByXxx() can find documents in a range by passing an array as the value with the start and end keys\n\n    domain.TestUser.findAllByUsername(['a','aZ'], function(users) { // passed the user objects where username starts with 'a'})\n\n\n## addView()\n\nYou can also add views after a domain constructor is initialized by using the addView() method\n\n    var view = {\n           map: function(doc) {\n                    emit(doc.firstName + ':' + doc.lastName, doc);\n                }\n            }\n\n    function callbqack(){}\n\n    domain.TestUser.addView('lastAndFirstName', view, callback);\n\nAfter that the view is available as finders just like any other view\n\n    domain.TestUser.findAllByFirstAndLastName('Scott:Burch', function(users) {})\n    domain.TestUser.findByFirstAndLastName('Scott:Burch', function(user) {})\n\n\n## properties\n\nid = the DB id\n\nrev = the DB revision\n\ndateCreated = the date the object was first saved to the DB\n\nlastUpdated = the date the object was last updated\n\n## constructor properties\n\nviewNames = the list of view names\n\n## custom views\n\nYou can also add custom views to any domain constructor\n\nThe following example will create a view to find a user by first or last name:\n\n    domain.create('TestUser',{\n        dbName: 'my-db'\n        properties:{\n            username: {},\n            password: {},\n            firstName:{},\n            lastName: {},\n        },\n        hasMany: {\n           phoneNumbers: 'PhoneNumber',\n           children: {type: 'Child', singular: 'child'}\n        },\n        views: {\n            firstOrLastName: {map: function(doc) {\n                emit(doc.firstName, doc);\n                emit(doc.lastName, doc);\n            }}\n        }\n    });\n\nThis code will also add static finders:\n\n    domain.TestUser.findAllByFirstOrLastName('Test',function() {});\n    domain.TestUser.findByFirstOrLastName('Tester',function() {});\n\n\n## Associations\n\ncouch-ar now supports hasMany associations.  To define a hasMany association pass a __hasMany__ in the config as shown above.\nThe value 'PhoneNumber' and 'Child' is a previously defined model.\n\nWhen you only supply a string then the singular names will be converted by chopping the 's' off the end.\nThe result is three new methods.\n\nAssuming the hasMany definition above the result will be 6 methods:\n\n* __addPhoneNumber(pn)__\n* __getPhoneNumbers(callback)__\n* __removePhoneNumber(pn)__\n* __addChild(c)__\n* __getChildren(callback)__\n* __removeChild(c)__\n\nthe add and remove can take a phone number directly. However, getters requires a callback which will be passed the result.\nThe items passed to add and remove must be persisted before trying to add or remove them.\n\n\n\n\n## License\n\nProvided under the MIT license.  In other words, do what you want with it.\n\n","maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}]}},"maintainers":[{"name":"scottburch","email":"scott@bulldoginfo.com"}],"author":{"name":"Scott Burch","email":"scott@bulldoginfo.com"},"time":{"modified":"2022-06-14T01:40:19.494Z","created":"2011-02-03T01:29:24.057Z","0.1.0":"2011-02-03T01:29:24.057Z","0.1.1":"2011-02-03T01:29:24.057Z","0.1.2":"2011-02-23T03:09:37.650Z","0.1.3":"2011-02-23T03:14:15.511Z","0.1.4":"2011-03-17T18:00:56.562Z","0.1.5":"2011-03-18T13:47:46.244Z","0.1.6":"2011-05-23T17:08:43.383Z","0.2.0":"2011-08-07T17:00:44.014Z","0.2.2":"2011-10-31T04:55:33.406Z","0.2.3":"2011-10-31T06:03:57.797Z","0.2.4":"2011-10-31T06:38:33.804Z","0.2.5":"2011-11-05T23:09:27.991Z","0.3.1":"2012-02-01T19:33:17.039Z","0.3.2":"2012-02-01T23:17:17.172Z","0.3.3":"2012-03-04T23:55:18.210Z","0.3.4":"2012-03-10T20:12:54.478Z"}}