{"_id":"drossel-mongoose","_rev":"28-a7e61c0ef27043b4fab18e3ecc3bc4c2","name":"drossel-mongoose","description":"Unnecessary mongoose wrapper","dist-tags":{"latest":"1.2.1"},"versions":{"1.0.2":{"name":"drossel-mongoose","description":"Unnecessary mongoose wrapper","version":"1.0.2","author":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"homepage":"http://drossel.io/","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Heizregister/drossel-mongoose.git"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["mongodb","mongoose","express"],"dependencies":{"lodash":"^3.10.1"},"gitHead":"0b9a4da7e920dd37abe57f58bc0bc5e831d19b13","bugs":{"url":"https://github.com/Heizregister/drossel-mongoose/issues"},"_id":"drossel-mongoose@1.0.2","_shasum":"939bf3a89d7828758f2a3171a6471d5b44949639","_from":".","_npmVersion":"3.3.6","_nodeVersion":"5.0.0","_npmUser":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"dist":{"shasum":"939bf3a89d7828758f2a3171a6471d5b44949639","tarball":"https://registry.npmjs.org/drossel-mongoose/-/drossel-mongoose-1.0.2.tgz","integrity":"sha512-LH8rJpWE5O/ldobuCjD8KeqPklv3EU3W9RRkMjucs5BcPcOX7cmutLg776s17m6GjWxz9qRSMtzxA/tB3p5A1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDdlz7ww8f/1VEGyRSE9kEldYvC7ZquS0I/r4ODn2dthQIhAIzSmESxnEEN6J6d8vrBs2pg96AjdsO2ss8J7ae4sA+3"}]},"maintainers":[{"name":"nanocloudx","email":"nanocloudx@gmail.com"}]},"1.1.1":{"name":"drossel-mongoose","description":"Unnecessary mongoose wrapper","version":"1.1.1","author":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"homepage":"http://drossel.io/","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Heizregister/drossel-mongoose.git"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["mongodb","mongoose","express"],"gitHead":"4e76a765b7b484d8302e1c88b661ac94253ed87a","bugs":{"url":"https://github.com/Heizregister/drossel-mongoose/issues"},"_id":"drossel-mongoose@1.1.1","_shasum":"e5617232cd2527f08e0bea4b8358c39c2118bca3","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.4.0","_npmUser":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"dist":{"shasum":"e5617232cd2527f08e0bea4b8358c39c2118bca3","tarball":"https://registry.npmjs.org/drossel-mongoose/-/drossel-mongoose-1.1.1.tgz","integrity":"sha512-ygUVKBN3+tDIjvWZ0cl7yrRUAWYyHBgEsu5U4dbweoO8re7i01BfZr+dT1fwdfYV01eSzboN4np5DuoPMuJEow==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHd4QRmV7PyXyeiDAYJx3SaHdkozr8ElJaVW/c807kXkAiEA6DbbFU6FeNd2TZhZxXf5sGqFNOf6bffWHZkCDbIISsQ="}]},"maintainers":[{"name":"nanocloudx","email":"nanocloudx@gmail.com"}]},"1.1.2":{"name":"drossel-mongoose","description":"Unnecessary mongoose wrapper","version":"1.1.2","author":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"homepage":"http://drossel.io/","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Heizregister/drossel-mongoose.git"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["mongodb","mongoose","express"],"dependencies":{"lodash":"^3.10.1"},"gitHead":"e5649faea57f5448e5ed2d4fedaa927613aa9d23","bugs":{"url":"https://github.com/Heizregister/drossel-mongoose/issues"},"_id":"drossel-mongoose@1.1.2","_shasum":"f38e241dcafcc4615b7f87261787caf321a3949f","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.4.0","_npmUser":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"dist":{"shasum":"f38e241dcafcc4615b7f87261787caf321a3949f","tarball":"https://registry.npmjs.org/drossel-mongoose/-/drossel-mongoose-1.1.2.tgz","integrity":"sha512-Smq4dI13yjMJCB/vaB0UD04+ZELAcyVSxaUqcrjbTx1oKwrJLtwvv5VMOE2FE7I2zjQBW1tKpge5kMvssBxz9A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCmyFxn7FFBrfkQmTqh1xoJe8Sn1DSGuEkQPzwFvzBf9AIhAPRvJ6bx6Cj9yNHk4JkCQryAE3XV9VZd4MA3/jjGTwvr"}]},"maintainers":[{"name":"nanocloudx","email":"nanocloudx@gmail.com"}]},"1.2.1":{"name":"drossel-mongoose","description":"Unnecessary mongoose wrapper","version":"1.2.1","author":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"homepage":"http://drossel.io/","license":"MIT","repository":{"type":"git","url":"git+https://github.com/nanocloudx/drossel-mongoose.git"},"main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["mongodb","mongoose","express"],"dependencies":{"lodash":"^3.10.1"},"gitHead":"c97fa542932f9e4c6c4a663faca4ea681e8fe4f6","bugs":{"url":"https://github.com/nanocloudx/drossel-mongoose/issues"},"_id":"drossel-mongoose@1.2.1","_shasum":"500f20c3d945bb820fc0329b9edbe3424d7c1ada","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.4.0","_npmUser":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"dist":{"shasum":"500f20c3d945bb820fc0329b9edbe3424d7c1ada","tarball":"https://registry.npmjs.org/drossel-mongoose/-/drossel-mongoose-1.2.1.tgz","integrity":"sha512-pHbr6xB+wHGV20NJz7BC9xfrXYvj1X8STKhtofIfWVud70aumOsl//dUAB8fhfFSJ6hLz5b71HG0J6E5z3CnCw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF7u1VXa/1Vgqn1rcNWPIG8ieo7lm0maYq7bjDrSuDdPAiEAquDXDiF2GPg+FDiLG7zc8dDfqDZtO1cowMzE62o64nU="}]},"maintainers":[{"name":"nanocloudx","email":"nanocloudx@gmail.com"}]}},"readme":"# drossel-mongoose\nUnnecessary mongoose wrapper\n\n[![NPM](https://nodei.co/npm/drossel-mongoose.png)](https://nodei.co/npm/drossel-mongoose/)\n\n## What is this?\n\"drossel-mongoose\" add value similar to the HTTP status code, on the results of the mongoose.\n\n## Install\nstep1: npm install\n```\nnpm install drossel-mongoose\n```\n\nstep2: require and prepare mongoose.model\n```\nvar drmg = require('drossel-mongoose');\nvar mongoose = require('mongoose');\nvar model = mongoose.model('Example', new mongoose.Schema({\n  foo: { type: String },\n  bar: { type: Number }\n}));\n```\n\n## Usage\n\n### Create (model, obj)\nCreate data.  \nreturn drossel-mongoose response, into created data object.\n```\ndrmg.create(model, { foo: 'abc', bar: 123 });\n```\n\n### Find (model, conditions)\nFind data.  \nreturn drossel-mongoose response, into find data objects array.\nTips: If no result, resolve \"success\".\n```\ndrmg.find(model, { foo: 'abc' });\n```\n\n### FindOne (model, conditions)\nFind data.\nreturn drossel-mongoose response, into find data object.\nTips: If no result, reject \"not found\".\n```\ndrmg.find(model, { foo: 'abc' });\n```\n\n### FindById (model, objectId)\nFind data from ID.  \nreturn drossel-mongoose response, into find data object.\nTips: If no result, reject \"not found\".\n```\ndrmg.findById(model, 1234567890abcdef12345678);\n```\n\n### Update (model, objectId, obj)\nUpdate data.  \nreturn drossel-mongoose response, into updated data object.\n```\ndrmg.update(model, 1234567890abcdef12345678, { foo: 'xyz', bar: 456 });\n```\n\n### Remove (model, conditions)\nRemove data.  \nreturn drossel-mongoose response, into null.\n```\ndrmg.remove(model, { _id: 1234567890abcdef12345678 });\n```\n\n### All (array)\nPromise.all for drossel-mongoose.  \nreturn drossel-mongoose response.\n```\ndrmg.all([\n  drmg.find(model, {foo: 'foo'}),\n  drmg.remove(model, {bar: 'bar'})\n]);\n```\n\n### status\nreturn HTTP status code list.  \nex) SUCCESS, NOT_FOUND, BAD_REQUEST, TEAPOT, ...\n```\nconsole.log(drmg.status.SUCCESS) //200\n```\n\n### response (status, data)\nreturn drossel-mongoose response.\n```\ndrmg.response(drmg.status.SUCCESS, {\n  lgtm: 'LGTM!'\n}); // Promise.<{status: 200, data: {lgtm: 'LGTM!'}}>\n```\n\n### expressResponse (res, response)\nuseful to Express framework.  \nPlease refer to the example of use for more information.\n\n## Example\ndrossel-mongoose returns Promises.  \nresults included status and data.\n```\ndrmg.find(model, {}).then(function(result) {\n  console.log(result);\n});\n\n// {\n//   status: 200,\n//   data: [{ foo: 'abc', bar: 123 }]\n// }\n```\n\nIf you're using the Express framework,  \nit can response the `res.status()` and `res.json()`, when you use the `drmg.expressResponse()`.\n```\nvar router = express.Router();\nrouter.get('/:id?', function(req, res, next) {\n  drmg.expressResponse(res, drmg.findById(model, req.params.id));\n};\n```\n\nor, it can custom response.\n```\nvar router = express.Router();\nrouter.get('/', function(req, res, next) {\n  drmg.expressResponse(res, drmg.response(drmg.status.SUCCESS, {\n    lgtm: 'Looks Good To Me!'\n  }));\n});\n```\n","maintainers":[{"name":"nanocloudx","email":"nanocloudx@gmail.com"}],"time":{"modified":"2022-06-16T00:34:20.963Z","created":"2015-12-19T10:04:00.001Z","1.0.0":"2015-12-19T10:04:00.001Z","1.0.1":"2015-12-19T10:30:49.137Z","1.0.2":"2015-12-19T11:03:48.521Z","1.1.0":"2016-01-10T12:45:27.201Z","1.1.1":"2016-01-10T13:17:02.573Z","1.1.2":"2016-01-10T13:22:52.065Z","1.1.3":"2016-01-10T18:30:49.661Z","1.1.4":"2016-01-10T20:55:56.313Z","1.1.5":"2016-01-10T21:16:59.146Z","1.1.6":"2016-01-10T21:57:12.010Z","1.1.7":"2016-01-11T19:18:12.070Z","1.1.8":"2016-01-11T19:33:23.842Z","1.1.9":"2016-01-11T20:55:24.818Z","1.2.0":"2016-01-13T17:21:41.537Z","1.2.1":"2016-01-13T19:28:57.534Z"},"homepage":"http://drossel.io/","keywords":["mongodb","mongoose","express"],"repository":{"type":"git","url":"git+https://github.com/nanocloudx/drossel-mongoose.git"},"author":{"name":"nanocloudx","email":"nanocloudx@gmail.com"},"bugs":{"url":"https://github.com/nanocloudx/drossel-mongoose/issues"},"license":"MIT","readmeFilename":"README.md"}