{"_id":"underscore.db","_rev":"25-270896a4309f67a2c7be804649565b27","name":"underscore.db","description":"Use JavaScript objects as databases","dist-tags":{"latest":"0.7.0"},"versions":{"0.1.0":{"name":"underscore.db","version":"0.1.0","description":"Use JavaScript objects as databases","main":"dist/underscore.db.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-contrib-copy":"~0.5.0","grunt-cli":"~0.1.11"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.1.0","dist":{"shasum":"1bddecadd64ab3afcdb14ffc00638d85386cccff","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.1.0.tgz","integrity":"sha512-II0G+bahlo/0QSEs4pJizEokGWW4X4TSp81iKOf0D3Y6xQJaFUJ1nSKr28+VjieukYaO/V+iyM9rmPvjQvGX5w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF8nyc9Us4/P6bjct0fM7xnEyo8qp1pCGR15R9ZB2RVCAiEA3j7joq16snRQERE94ZBukYz4u5bzK0y4YpaHN9H9yeQ="}]},"_from":".","_npmVersion":"1.3.21","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.2.0":{"name":"underscore.db","version":"0.2.0","description":"Use JavaScript objects as databases","main":"dist/underscore.db.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-contrib-copy":"~0.5.0","grunt-cli":"~0.1.11"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.2.0","dist":{"shasum":"f127a57f5ec895fd0105772e335cc5ad6aed2d08","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.2.0.tgz","integrity":"sha512-Bmi2iropvGGg17XA2QDTDRZqa1laO72HH0q9gX9bZHlHLiaSuGht1lQcjul/4FmrGOo+PKTM4+eNveCf5WK9aQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAiZdZSZ1ZFCoiCfsw3dbg3xqd2SHBzYqBO+eod7bMXEAiBBBjZHGz2UU9ml+cePP+9BiCfXsUoNDd+5nkUmSjPakw=="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.2.1":{"name":"underscore.db","version":"0.2.1","description":"Use JavaScript objects as databases","main":"dist/underscore.db.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-contrib-copy":"~0.5.0","grunt-cli":"~0.1.11"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.2.1","dist":{"shasum":"dbf0663379e098a10d75e89724134e585f20ab3c","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.2.1.tgz","integrity":"sha512-W+WNaYqgUlnqVPv81fgeOOheyo1486Gc8n5llBLIZHwSFjj5bLlO1nT8z0Pv9zZkBpWafgmTqfKnYy9xTz623Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDZ1d/DuAkewXUyclrW5ogX+epWImfgTqUiLOQUZP1szQIgOYpDVkgxDw1d6ImdmFJKk3LmdTGNsQTY7O2UGfN+3+k="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.3.0":{"name":"underscore.db","version":"0.3.0","description":"Use JavaScript objects as databases","main":"dist/underscore.db.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-contrib-copy":"~0.5.0","grunt-cli":"~0.1.11"},"_id":"underscore.db@0.3.0","dist":{"shasum":"e279d64693f51f3d15951f1b7eca908ddf9d641e","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.3.0.tgz","integrity":"sha512-KNz6tG49NsyL9SUpRrwfbCrfo9AOQDRcLlbD2Bbzmofq6IoqNJT+qNmSOBjBKr3bp+cNU+mFzmYxgWLEPsoptw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDT57xAUC+PL1RyumQkkCQoro3TnZ25FH/+Rj3+j3t1tgIgIODcmZrQfg2b0UETcHTtbFf7D6vNyDWmD4CZTHcNjyQ="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.4.0":{"name":"underscore.db","version":"0.4.0","description":"Use JavaScript objects as databases","main":"dist/underscore.db.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","lodash":"~2.4.1","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-contrib-copy":"~0.5.0","grunt-cli":"~0.1.11"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.4.0","dist":{"shasum":"d9573f3558f841849312394c7a22f55a1a06d0e9","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.4.0.tgz","integrity":"sha512-FIxbpnzgPrXhksrYuU35Rlz+PpTubUTgQ6ac7MTaGo31OdamSYfK+o4SDCDcg/sH2mW6vQr4S2ZqooeNc41UJw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCtW2WLI8VuYyEFwgpdlApg7h66SVQUHivtxNwdHThTZAIgN/Gunq+qLBvuBAIwl2lh2/S3gS7jSA5Rsv5eA4ThJbQ="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.5.0":{"name":"underscore.db","version":"0.5.0","description":"Use JavaScript objects as databases","main":"src/node.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","lodash":"~2.4.1","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-cli":"~0.1.11","grunt-browserify":"~1.3.0"},"_id":"underscore.db@0.5.0","dist":{"shasum":"11530de13bcb0bf076c11e61f8c26901acc5df48","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.5.0.tgz","integrity":"sha512-KAiUvKBc/FpKcw6m7y/VIGJ/LmG5ozJuu4O3sOn7NOlhbYZH9GEbmZPFikRPTbi1w7K70MhqPudKup4hA4ZFkg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDACk1WIIgbm9TDufO50Z9JLfYDXdZn9+HwRd7uSm9S6AiANqVZx35xWHYFoOs9/fVUvk0yuVbE/RwmH3/iqTXwxiQ=="}]},"_from":".","_npmVersion":"1.2.14","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"directories":{},"deprecated":"Project has been renamed to underscore-db"},"0.5.1":{"name":"underscore.db","version":"0.5.1","description":"Use JavaScript objects as databases","main":"src/node.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object"],"devDependencies":{"underscore":"~1.5.2","lodash":"~2.4.1","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-cli":"~0.1.11","grunt-browserify":"~1.3.0"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.5.1","dist":{"shasum":"8ba41a692158d451ae2e5c3be6a0ea42fc521dcf","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.5.1.tgz","integrity":"sha512-gBuW0eH9rQBZpkefpImJxsoo85QGByEaXOhalCXKovraNR1UvpTpdOFjGwS5k4hde5nbKeDnMlKvRnH2wq9LqQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDHTXkEcN5u+OPJ3fEgMz45WFKXEBd3mJQUYVshwCag7AiEA7igsmnPdpeBiMkMiqYdJf2q56enD7TV6dPik80BFo9Q="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"deprecated":"Project has been renamed to underscore-db"},"0.6.0":{"name":"underscore.db","version":"0.6.0","description":"Use JavaScript objects as databases","main":"src/node.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object","embed","embeddable"],"devDependencies":{"underscore":"~1.5.2","lodash":"~2.4.1","grunt":"~0.4.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-jshint":"~0.7.2","grunt-mocha-test":"~0.7.0","grunt-contrib-watch":"~0.5.3","grunt-cli":"~0.1.11","grunt-browserify":"~1.3.0","sinon":"~1.8.1"},"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.6.0","dist":{"shasum":"f1469913e9f4d9fd459a786c5316daa993fd5a32","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.6.0.tgz","integrity":"sha512-vywZh27HvD+cg6RiG23qzD3J0K9x8DbzC6SBSTozOp4hbt7bVVGPxEU02EE0wpifECJDWJYzEiNOHTeoryemog==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICj6y7KKeYBxvseXsxEC/VWAOaDH2uYlqWnn05RvWNCUAiEA/CumQAJz+9EyxSmz2kJnujsfUgl8M7wZdQVAXIMkwDY="}]},"_from":".","_npmVersion":"1.3.24","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"deprecated":"Project has been renamed to underscore-db"},"0.6.1":{"name":"underscore.db","version":"0.6.1","description":"Use JavaScript objects as databases","main":"src/node.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object","embed","embeddable"],"devDependencies":{"grunt":"~0.4.2","grunt-browserify":"~1.3.0","grunt-cli":"~0.1.11","grunt-contrib-jshint":"~0.7.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-watch":"~0.5.3","grunt-mocha-test":"~0.7.0","lodash":"^2.4.1","sinon":"~1.8.1","underscore":"^1.6.0"},"gitHead":"6cf0904fe1264ac1ac6e9072881258ebe99280d8","bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.6.1","_shasum":"9501310b800ed003d9fe1cc8a0bc4567a10c7469","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"dist":{"shasum":"9501310b800ed003d9fe1cc8a0bc4567a10c7469","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.6.1.tgz","integrity":"sha512-3qHhKtJ9g6W0WmRRDBzzfKw0BkP9YEaslFVd9bFq1beKwF1SZR3ht4OIHqwkbe2+jpTfg29eaApaE5qTQEkzpA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMiPL/uw5j7QDvik4ONCgZMHC/JqGRNgWF49now/YNYgIhAPc/aZH4z5xyE903Ns+Gk1ZO7zDbMf+0XFjjoUp1/9YL"}]},"deprecated":"Project has been renamed to underscore-db"},"0.7.0":{"name":"underscore.db","version":"0.7.0","description":"Use JavaScript objects as databases","main":"src/node.js","scripts":{"test":"grunt test"},"author":{"name":"Typicode","email":"typicode@gmail.com"},"license":"MIT","repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object","embed","embeddable"],"devDependencies":{"grunt":"~0.4.2","grunt-browserify":"~1.3.0","grunt-cli":"~0.1.11","grunt-contrib-jshint":"~0.7.2","grunt-contrib-uglify":"~0.2.7","grunt-contrib-watch":"~0.5.3","grunt-mocha-test":"~0.7.0","lodash":"^2.4.1","sinon":"~1.8.1","underscore":"^1.7.0"},"gitHead":"9da1bacff6fbd224615e0f52701e4de6af75efa6","bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"homepage":"https://github.com/typicode/underscore.db","_id":"underscore.db@0.7.0","_shasum":"343f931799a426a7b74c88e3417a5e593719fb2f","_from":".","_npmVersion":"1.4.14","_npmUser":{"name":"typicode","email":"typicode@gmail.com"},"maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"dist":{"shasum":"343f931799a426a7b74c88e3417a5e593719fb2f","tarball":"https://registry.npmjs.org/underscore.db/-/underscore.db-0.7.0.tgz","integrity":"sha512-ywriJ6n5z3GaNJ3JJUbTLG1TS0KV6VNK+3PRCgh84oLQWKcn09i/nyNv03TOhIKaItwLwo1OKjCZxGlR+E9TFg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFCnDnBLN07FWVwPRYZ8lRWHO/QKHehNz/fbU1/DB6ERAiBUyMrFZLSS4+icQpI8/nV87TJouYabn9iIWSErRuMZcQ=="}]},"deprecated":"Project has been renamed to underscore-db"}},"readme":"# Underscore.db [![Build Status](https://travis-ci.org/typicode/underscore.db.svg)](https://travis-ci.org/typicode/underscore.db) [![NPM version](https://badge.fury.io/js/underscore.db.svg)](http://badge.fury.io/js/underscore.db) [![Bower version](https://badge.fury.io/bo/underscore.db.svg)](http://badge.fury.io/bo/underscore.db)\n\n> Adds functions to Underscore/Lo-Dash for manipulating database-like objects.\n\nIt adds:\n* `get`\n* `insert`\n* `update`\n* `updateWhere`\n* `remove`\n* `removeWhere`\n* `save`\n* `load`\n* `createId`\n\nData can be persisted using the filesystem or localStorage.\n\n__[Live example](http://typicode.github.io/underscore.db/)__\n\n_For a full JSON database built on Lo-Dash and Underscore.db, check [LowDB](https://github.com/typicode/lowdb)._\n\n## Install\n\n__Node__\n\n```bash\n$ npm install underscore underscore.db\n```\n\n```javascript\nvar _   = require('underscore');\nvar _db = require('underscore.db');\n\n_.mixin(_db);\n```\n\n__Browser__\n\n```bash\n$ bower install underscore underscore.db\n```\n\n```html\n<script src=\"underscore.js\" type=\"text/javascript\"></script>\n<script src=\"underscore.db.js\" type=\"text/javascript\"></script>\n```\n\nTo use Underscore.db with Lo-Dash, just replace `underscore` with `lodash`\n\n## Usage example\n\nCreate an empty database object\n\n```javascript\nvar db = {\n  posts: []\n}\n```\n\nCreate a post\n\n```javascript\nvar newPost = _.insert(db.posts, {title: 'foo'});\n```\n\nDisplay database `console.log(db)`\n\n```javascript\n{\n  posts: [\n    {title: \"foo\", id: \"5ca959c4-b5ab-4336-aa65-8a197b6dd9cb\"}\n  ]\n}\n```\n\nRetrieve post using underscore.db `get` or underscore `find` method\n\n```javascript\nvar post = _.get(db.posts, newPost.id);\n\nvar post = _.find(db.posts, function(post) {\n  return post.title === 'foo'\n});\n```\n\nPersist\n\n```javascript\n_.save(db);\n```\n\n## API\n\nThe following database object is used in API examples.\n\n```javascript\nvar db = {\n  posts: [\n    {id: 1, body: 'one', published: false},\n    {id: 2, body: 'two', published: true}\n  ],\n  comments: [\n    {id: 1, body: 'foo', postId: 1},\n    {id: 2, body: 'bar', postId: 2}\n  ]\n}\n```\n\n__get(collection, id)__\n\nFinds and returns document by id or undefined.\n\n```javascript\nvar post = _.get(db.posts, 1);\n```\n\n__insert(collection, document)__\n\nAdds document to collection, sets an id and returns created document.\n\n```javascript\nvar post = _.insert(db.posts, {body: 'New post'});\n```\n\n__update(collection, id, attrs)__\n\nFinds document by id, copies properties to it and returns updated document or undefined.\n\n```javascript\nvar post = _.update(db.posts, 1, {body: 'Updated body'});\n```\n\n__updateWhere(collection, whereAttrs, attrs)__\n\nFinds documents using `_.where`, updates documents and returns updated documents or an empty array.\n\n```javascript\n// Publish all unpublished posts\nvar posts = _.updateWhere(db.posts, {published: false}, {published: true});\n```\n\n__remove(collection, id)__\n\nRemoves document from collection and returns it or undefined.\n\n```javascript\nvar comment = _.remove(db.comments, 1);\n```\n\n__removeWhere(collection, whereAttrs)__\n\nRemoves documents from collection using `_.where` and returns removed documents or an empty array.\n\n```javascript\nvar comments = _.removeWhere(db.comments, {postId: 1});\n```\n\n__save(db, [destination])__\n\nPersists database using localStorage or filesystem. If no destination is specified it will save to `db` or `./db.json`.\n\n```javascript\n_.save(db);\n_.save(db, '/some/path/db.json');\n```\n\n__load([source])__\n\nLoads database from localStorage or filesystem. If no source is specified it will load from `db` or `./db.json`.\n\n```javascript\nvar db = _.load();\nvar db = _.load('/some/path/db.json');\n```\n\n__id__\n\nOverwrite it if you want to use another id property.\n\n```javascript\n_.id = '_id';\n```\n\n__createId(collectionName, doc)__\n\nCalled by Underscore.db when a document is inserted. Overwrite it if you want to change id generation algorithm.\n\n```javascript\n_.createId = function(collectionName, doc) {\n  return collectionName + '-' + doc.name + '-' + _.random(1, 9999);\n}\n```\n\n## FAQ\n\n### How to query?\n\nEverything you need for querying is present in Underscore and Lo-Dash: `where`, ```find```, ```map```, ```reduce```, ```filter```, ```reject```, ```sortBy```, ```groupBy```, ```countBy```, ...\n\nSee http://underscorejs.org/ or http://lodash.com/docs.\n\nExample:\n\n```javascript\n// Using Underscore\nvar topFivePosts = _(db.posts)\n  .chain()\n  .where({published: true})\n  .sortBy(function(post) {\n     return post.views;\n   })\n  .first(5)\n  .value();\n\n// Using Lo-Dash\nvar topFivePosts = _(db.posts)\n  .where({published: true})\n  .sortBy('views')\n  .first(5)\n  .value();\n```\n\n### How to reduce file size?\n\nWith Lo-Dash, you can create optimal builds and include just what you need.\n\nMinimal build for Underscore.db to work (~2kb min gzipped):\n\n```bash\n$ npm install -g lodash-cli\n$ lodash underscore include=find,where,clone,indexOf\n```\n\nFor more build options, see http://lodash.com/custom-builds.\n\n## License\n\nUnderscore.db is released under the MIT License.","maintainers":[{"name":"typicode","email":"typicode@gmail.com"}],"time":{"modified":"2022-06-28T04:07:48.103Z","created":"2014-01-13T14:54:07.228Z","0.1.0":"2014-01-13T14:54:07.228Z","0.2.0":"2014-01-25T04:45:24.573Z","0.2.1":"2014-01-25T05:54:05.581Z","0.2.2":"2014-01-27T04:52:35.835Z","0.3.0":"2014-01-27T06:44:58.281Z","0.4.0":"2014-01-29T03:25:09.841Z","0.5.0":"2014-02-04T10:00:51.876Z","0.5.1":"2014-02-06T10:37:42.412Z","0.6.0":"2014-02-18T01:08:56.729Z","0.6.1":"2014-07-17T14:20:48.380Z","0.7.0":"2014-09-03T00:45:48.226Z"},"readmeFilename":"README.md","author":{"name":"Typicode","email":"typicode@gmail.com"},"repository":{"type":"git","url":"https://github.com/typicode/underscore.db.git"},"homepage":"https://github.com/typicode/underscore.db","keywords":["JavaScript","Underscore","Lo-Dash","lodash","database","datastore","JSON","object","embed","embeddable"],"bugs":{"url":"https://github.com/typicode/underscore.db/issues"},"license":"MIT"}