{"_id":"mongoose-schema-extend","_rev":"39-0025ad0c428586b59d4492da6add7ec3","name":"mongoose-schema-extend","dist-tags":{"latest":"0.2.2"},"versions":{"0.1.0":{"name":"mongoose-schema-extend","version":"0.1.0","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.0","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","dist":{"shasum":"a96bcb5ece1002a7d5a6d7a4c2158cbcca8a2e75","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.0.tgz","integrity":"sha512-eQGL1NbPWou1psZqFlXYt4yU4snbyIo6mIGvONMjlWMwC6ypPJYi1OsVNbe9mek4bk/bZKdXDTXDydBezug3Cg==","signatures":[{"sig":"MEYCIQCZLGRVc+M6xrfeCoLjqmL+U3DT9VazBs+ZtOwy+UnUWAIhANOBu8y0hl41zuoqRSBxefNsIPra4l4Tkv+QDt4oe9kI","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"mocha"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"description":"mongoose schema inheritance and discriminator key extension","dependencies":{"clone":"~0.1.0","mocha":"~1.3.2"},"devDependencies":{"should":"~1.1.0"},"directories":{}},"0.1.1":{"name":"mongoose-schema-extend","version":"0.1.1","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.1","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","dist":{"shasum":"1db0ac27cf6470004117f1731ed90e89782f98f2","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.1.tgz","integrity":"sha512-n9W/j4Uv31Gjxr8ee1PfV0AqF3n0CCvQlq0jvdJTvYzNbJ1q6MYna1Sc22oj2uhYGuA6KX90P+iPpVFzcPl1sQ==","signatures":[{"sig":"MEUCIQCejXxMZU90KVlq2WIiSuUWl47bM1PqDTLQ3y5C1vW2pQIgbNSVXkPXiyNYIVvExrkQ9CVQhbK7ECgkV6fsqfre1f4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"mocha"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"description":"mongoose schema inheritance and discriminator key extension","dependencies":{"clone":"~0.1.0","mocha":"~1.3.2"},"devDependencies":{"should":"~1.1.0"},"directories":{}},"0.1.2":{"name":"mongoose-schema-extend","version":"0.1.2","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.2","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","dist":{"shasum":"5e8ba389ad618fa903d7038f9ef05205b7974222","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.2.tgz","integrity":"sha512-3jLAHJzQoD3x+GD0a130R9AB0KT92wVFS8YA/c5QWhAve4DIsJhAmD57oXjehtsfXJCGllT/HmnpUukoQmJ5vQ==","signatures":[{"sig":"MEUCICybIZZjE1RZdJFBDw2KmfGbu9b/zGdoKZhoOVcnApsCAiEAmpRV0fHXr0qjaewTxmSOJiMyF/3+2njlvpfD/7zDaHk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.1.69","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"mocha":"~1.3.2","owl-deepcopy":"~0.0.1"},"devDependencies":{"should":"~1.1.0"},"directories":{}},"0.1.3":{"name":"mongoose-schema-extend","version":"0.1.3","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.3","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","dist":{"shasum":"8ee39f48c7a0beb4aad555c25cbac59fe7bd6502","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.3.tgz","integrity":"sha512-A4nlAruPom4HjCxjsRHIuplpd6Owh48FdlSnRzFp59RtrFhG7A8MHGlCU0gKUqkm6Nlgytqbuj8xVVDOSqe/aQ==","signatures":[{"sig":"MEQCID4ONe8NGFOIUxknVwjwG4U9BMjLEWDqPCg9UZEn5sQ6AiA8PxxFhMTzKvK0cnv1HeDYffp8oVRuYaS1L52Qxo6rvA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.1.69","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"mocha":"~1.3.2","owl-deepcopy":"~0.0.1"},"devDependencies":{"should":"~1.1.0"},"directories":{}},"0.1.4":{"name":"mongoose-schema-extend","version":"0.1.4","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.4","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","dist":{"shasum":"9f61b2abba5352fcd3d7b1193ee4b4d9f2a83804","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.4.tgz","integrity":"sha512-X0l/9vcxm4E6salirH+aYh5CM6Xp5tAZap3zrSNUTqKnqn0cGzQ1ZFrvvTjNF/JivOcaePF3UfPnCeZRWqLgbw==","signatures":[{"sig":"MEQCIBqhDMKv6KXS70xN7Pg7XWrI0tKDJp0mGiYPSz1+YWpQAiB+0qwsx/G+Y2SKHJ+ixLVTEp6CnPtHZNVAn8mqlRbipg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.2.18","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"owl-deepcopy":"~0.0.1"},"devDependencies":{"mocha":"~1.3.2","should":"~1.1.0"},"directories":{}},"0.1.5":{"name":"mongoose-schema-extend","version":"0.1.5","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.5","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"d2ab3d2005033daaa215a806bbd3f6637c9c96c3","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.5.tgz","integrity":"sha512-1zQw3p6RBrXi7mzG6x3HPDp/x4NPZk1FnJJHCWxl/JGSMGZq91E4mY/sGegjwULEqRjgzF6rkUyUPs38I6PLCQ==","signatures":[{"sig":"MEUCIAgpSUTqW7AyRYMFkxEvQC2AcbvHWAM/xvLHRbr0CU2SAiEA+GqZEpI/ODsSCBws12hyRhbqlA1RKuLix9mIPjzaHqU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.3.8","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"owl-deepcopy":"~0.0.1"},"devDependencies":{"mocha":"~1.3.2","should":"~1.1.0"},"directories":{}},"0.1.6":{"name":"mongoose-schema-extend","version":"0.1.6","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.6","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"6f4b38a6c98dc473f86e65e3eebc59c8e1d58a3c","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.6.tgz","integrity":"sha512-80Dwt17Tl2+NRfMx6SiY+xrZFF5OvwuKpg+oQ6CUjFCNA83A/4HLJOLLoZWiawxe4MqIDjxWZm8ETT6yT2K7Fw==","signatures":[{"sig":"MEQCIGIztXbn3vegrIosN5VLKrfQhZjEDi/9/zVWHtLoFEkpAiA3kOhPzj8q6rg805U2V/72DIVtu1PT6aP6rrVnzJsB5A==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.3.14","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"owl-deepcopy":"~0.0.1"},"devDependencies":{"mocha":"~1.3.2","should":"~1.1.0"},"directories":{}},"0.1.7":{"name":"mongoose-schema-extend","version":"0.1.7","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD","_id":"mongoose-schema-extend@0.1.7","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"50dc366ba63227d00c4cd3db9bb8bf95e9629910","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.1.7.tgz","integrity":"sha512-g8ycWsgLiloBD/fnHQDZ0RUom1mTCpYKCgahRP/J1SlIN4rXpOh9nyf4wJU8hLI0lO6tJ21CR7dJym0Gu2od5g==","signatures":[{"sig":"MEUCIASTKceptrwBtXTtvQCOfrd03BPBW/B7/tRhBil4ep6VAiEAuFKMubFmJSTXb2a3TRfDRyHNyUAbJRlHASiIKvfV2t0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha"},"_npmUser":{"name":"briankircho","email":"briankircho@gmail.com"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"1.3.14","description":"mongoose schema inheritance and discriminator key extension","dependencies":{"owl-deepcopy":"~0.0.1"},"devDependencies":{"mocha":"~1.3.2","should":"~1.1.0","mongoose":"~3.5.7"},"directories":{}},"0.2.0":{"name":"mongoose-schema-extend","version":"0.2.0","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"BSD-3-Clause","_id":"mongoose-schema-extend@0.2.0","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"},{"name":"sieira","email":"luis.sieira@spacebar.fr"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"},{"name":"Luis Sieira","email":"luis.sieira@spacebar.fr"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"1e5e8814f8c2ce1a49f66d1fbc71556ac99c8c39","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.2.0.tgz","integrity":"sha512-FMSCtKMRZrI4U7WIt3D1MWS5ZRG4ps2X2sGTJQzfwpdlVj+KkbZW3QQYOIEPdb1cydjWVIbzuKniBMqpgLlN/w==","signatures":[{"sig":"MEUCIElgVgoX3RtVrA+xPsvdIbCKW+mOQI8SGmSQYutKGlKyAiEA6mpkXtvji9Zsz21wWHBXnudh8y4s8P0BpkonNTZmdHk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"1e5e8814f8c2ce1a49f66d1fbc71556ac99c8c39","gitHead":"480a64c83a4aa4caec07ede81838764beaee35ce","scripts":{"test":"node ./node_modules/.bin/grunt test"},"_npmUser":{"name":"sieira","email":"luis.sieira@spacebar.fr"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"2.14.4","description":"mongoose schema inheritance and discriminator key extension","_nodeVersion":"4.1.1","dependencies":{"owl-deepcopy":"~0.0.1"},"devDependencies":{"glob":"^5.0.15","grunt":"^0.4.5","mocha":"^2.3.3","should":"~1.1.0","mongoose":"^4.2.4","grunt-cli":"^0.1.13","grunt-mocha-test":"^0.12.7"},"directories":{}},"0.2.1":{"name":"mongoose-schema-extend","version":"0.2.1","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"MIT","_id":"mongoose-schema-extend@0.2.1","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"},{"name":"sieira","email":"luis.sieira@spacebar.fr"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"},{"name":"Luis Sieira","email":"luis.sieira@spacebar.fr"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"e33d1ae6da66305db6e15e72909fb5d6ee8424f1","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.2.1.tgz","integrity":"sha512-/TlYbtdbbC6LAbtc8984z4rbPyxMvVmFfSuh9y3QZ6+j/N5+H4xAPVNOOVQH7MxNyYYwC4gFkqAsjuByi+xNYQ==","signatures":[{"sig":"MEQCIBTDHVCGo1hfFLtSaptAH9gOkKKLs1wbR5K6c/q8Dy1aAiAj6AnCLvF4cvK1Pgy7gxR6FdTRdQiU1hvik8a4l5Dqcw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"e33d1ae6da66305db6e15e72909fb5d6ee8424f1","gitHead":"04ca053d7435e4038a5adefa356d977170214ed9","scripts":{"test":"node --harmony_proxies ./node_modules/.bin/grunt test"},"_npmUser":{"name":"sieira","email":"luis.sieira@spacebar.fr"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"2.14.4","description":"mongoose schema inheritance and discriminator key extension","_nodeVersion":"4.1.1","dependencies":{"owl-deepcopy":"~0.0.1","harmony-reflect":"^1.4.2"},"devDependencies":{"glob":"^5.0.15","grunt":"^0.4.5","mocha":"^2.3.3","should":"~1.1.0","mongoose":"^4.2.4","grunt-cli":"^0.1.13","grunt-mocha-test":"^0.12.7"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-schema-extend-0.2.1.tgz_1455047478363_0.4717526831664145","host":"packages-5-east.internal.npmjs.com"},"directories":{}},"0.2.2":{"name":"mongoose-schema-extend","version":"0.2.2","keywords":["mongoose","inheritance","schema","discriminator","model"],"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"MIT","_id":"mongoose-schema-extend@0.2.2","maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"},{"name":"sieira","email":"luis.sieira@spacebar.fr"}],"contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"},{"name":"Luis Sieira","email":"luis.sieira@spacebar.fr"}],"homepage":"https://github.com/briankircho/mongoose-schema-extend","bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"dist":{"shasum":"f63dd313c422a3871f5569e36b0d28ca1a224631","tarball":"https://registry.npmjs.org/mongoose-schema-extend/-/mongoose-schema-extend-0.2.2.tgz","integrity":"sha512-AporsHo8g56IaAFpWstEJqM8tNhN4QirSL97TTqmD9Y4TmMg9I+5wW5hkska54F/Ck6KFZVpehy2Dm+k9jKNXA==","signatures":[{"sig":"MEUCIQC00SzVgH2gpIt6bX+7vHOTsF/NCEQoy3JW7OmPZKIJEQIgGI+51iEpm08vdwf3+tc3HvVZIS2cmhCv7/u00t6MBUg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"f63dd313c422a3871f5569e36b0d28ca1a224631","gitHead":"e309ddacbbdfce79b5042db02c7c491db245a974","scripts":{"test":"node --harmony_proxies ./node_modules/.bin/grunt test"},"_npmUser":{"name":"sieira","email":"luis.sieira@spacebar.fr"},"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"_npmVersion":"2.14.4","description":"mongoose schema inheritance and discriminator key extension","_nodeVersion":"4.1.1","dependencies":{"owl-deepcopy":"~0.0.1","harmony-reflect":"^1.4.2"},"devDependencies":{"glob":"^5.0.15","grunt":"^0.4.5","mocha":"^2.3.3","should":"~1.1.0","mongoose":"^4.2.4","grunt-cli":"^0.1.13","grunt-mocha-test":"^0.12.7"},"_npmOperationalInternal":{"tmp":"tmp/mongoose-schema-extend-0.2.2.tgz_1455322711820_0.46405054023489356","host":"packages-9-west.internal.npmjs.com"},"directories":{}}},"time":{"created":"2012-08-10T01:30:27.768Z","modified":"2026-04-24T23:31:05.828Z","0.1.0":"2012-08-10T01:30:29.110Z","0.1.1":"2012-08-10T23:48:33.558Z","0.1.2":"2013-01-18T05:07:41.193Z","0.1.3":"2013-01-20T03:23:02.105Z","0.1.4":"2013-07-18T07:01:18.212Z","0.1.5":"2013-09-28T20:00:10.077Z","0.1.6":"2013-11-21T04:49:59.322Z","0.1.7":"2013-11-21T23:05:24.356Z","0.1.9":"2015-11-11T09:56:16.754Z","0.1.8":"2015-11-11T09:57:32.087Z","0.2.0":"2015-11-11T10:05:22.884Z","0.2.1":"2016-02-09T19:51:19.951Z","0.2.2":"2016-02-13T00:18:35.312Z"},"bugs":{"url":"https://github.com/briankircho/mongoose-schema-extend/issues"},"author":{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},"license":"MIT","homepage":"https://github.com/briankircho/mongoose-schema-extend","keywords":["mongoose","inheritance","schema","discriminator","model"],"repository":{"url":"git://github.com/briankircho/mongoose-schema-extend.git","type":"git"},"description":"mongoose schema inheritance and discriminator key extension","contributors":[{"name":"Brian Kirchoff","email":"briankircho@gmail.com"},{"name":"Ajay Sabhaney","email":"ajay@mothercreative.com"},{"name":"Nicholas Calugar","email":"njcalugar@gmail.com"},{"name":"Luis Sieira","email":"luis.sieira@spacebar.fr"}],"maintainers":[{"name":"briankircho","email":"briankircho@gmail.com"},{"name":"sieira","email":"luis.sieira@spacebar.fr"}],"readme":"## mongoose-schema-extend\n\nImplements schema inheritance and an optional discriminator key which is useful for storing different types of related documents in a collection and fetching them with the correct model type.\n\n# Notice\n\nFrom version 0.2.1 mongoose-schema-extend is using harmony proxies. You will need to add the flag\n--harmony_proxies to your start command if you're using it, or use a previous version.\n\n# Usage\n\nInstall via NPM\n\n    $ npm install mongoose-schema-extend\n\n# Schema Inheritance\n\nYou just require the library to add schema extend method\n\n```javascript\nvar mongoose = require('mongoose'),\n    extend = require('mongoose-schema-extend');\nvar Schema = mongoose.Schema;\n\nvar PersonSchema = new Schema({\n  name : String\n}, { collection : 'users' });\n\nvar EmployeeSchema = PersonSchema.extend({\n  department : String\n});\n\nvar Person = mongoose.model('Person', PersonSchema),\n    Employee = mongoose.model('Employee', EmployeeSchema);\n\nvar Brian = new Employee({\n  name : 'Brian Kirchoff',\n  department : 'Engineering'\n});\n\n...\n```\n\n# Discriminator Key\n\nBy adding the discriminatorKey schema option, a key is added to your saved documents with the model name and is used when finding documents of different types to set them to the correct model\n\n```javascript\n...\nvar VehicleSchema = mongoose.Schema({ \n  make : String,\n}, { collection : 'vehicles', discriminatorKey : '_type' });\n\nvar CarSchema = VehicleSchema.extend({\n  year : Number\n});\nvar BusSchema = VehicleSchema.extend({\n  route : Number\n})\n\nvar Vehicle = mongoose.model('vehicle', VehicleSchema),\n    Car = mongoose.model('car', CarSchema),\n    Bus = mongoose.model('bus', BusSchema);\n\nvar accord = new Car({ \n  make : 'Honda',\n  year : 1999\n});\nvar muni = new Bus({\n  make : 'Neoplan',\n  route : 33\n});\n\naccord.save(function(err) {\n  muni.save(function(err) {\n    // vehicles are saved with the _type key set to 'car' and 'bus'\n  });\n})\n\n```\n\nAt this point in MongoDB you will have documents similar to this\n\n    { \"_type\" : \"car\", \"make\" : \"Honda\", \"year\" : 1999, \"_id\" : ObjectId(\"5024460368368a3007000002\"), \"__v\" : 0 }\n    { \"_type\" : \"bus\", \"make\" : \"Neoplan\", \"route\" : 33, \"_id\" : ObjectId(\"5024460368368a3007000003\"), \"__v\" : 0 }\n\nWhen querying, the objects model prototype will be set based on the _type field, so they are fully functional\n\n```javascript\nVehicle.find({}, function(err, vehicles) {\n  console.log(vehicles[0]); // vehicles[0] instanceof Car === true\n  console.log(vehicles[1]); // vehicles[1] instanceof Bus === true\n});\n```\n\n# Tests\n\nTo run the tests install mocha\n\n    npm install mocha -g\n\nand then run\n\n    mocha\n\n\n","readmeFilename":"README.md","users":{"neofreko":true,"no7david":true,"chkhikvadze":true,"goulash1971":true,"oliversalzburg":true}}