{"id":13778473,"url":"https://github.com/davideast/Querybase","last_synced_at":"2025-05-11T11:36:09.468Z","repository":{"id":70423065,"uuid":"48528555","full_name":"davideast/Querybase","owner":"davideast","description":"Bringing the where statement to the Firebase Database.","archived":true,"fork":false,"pushed_at":"2019-01-29T01:44:31.000Z","size":378,"stargazers_count":454,"open_issues_count":1,"forks_count":40,"subscribers_count":37,"default_branch":"master","last_synced_at":"2024-11-17T14:39:32.434Z","etag":null,"topics":["firebase","firebase-database"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davideast.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2015-12-24T06:25:50.000Z","updated_at":"2024-11-04T06:01:56.000Z","dependencies_parsed_at":"2023-03-13T20:24:02.859Z","dependency_job_id":null,"html_url":"https://github.com/davideast/Querybase","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideast%2FQuerybase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideast%2FQuerybase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideast%2FQuerybase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davideast%2FQuerybase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davideast","download_url":"https://codeload.github.com/davideast/Querybase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253560278,"owners_count":21927749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","firebase-database"],"created_at":"2024-08-03T18:00:54.088Z","updated_at":"2025-05-11T11:36:09.168Z","avatar_url":"https://github.com/davideast.png","language":"TypeScript","readme":"\u003cp align=\"center\"\u003e\n  \u003cimg height=\"75px\" width=\"411px\" src=\"https://raw.githubusercontent.com/davideast/Querybase/master/logos/logo-large.png\"\u003e\n  \u003cp align=\"center\"\u003eBringing the \u003ccode\u003e.where()\u003c/code\u003e statement to the Firebase Database\u003c/p\u003e\n\u003c/p\u003e\n\n[![Build Status](https://travis-ci.org/davideast/Querybase.svg?branch=master)](https://travis-ci.org/davideast/Querybase)\n[![Coverage Status](https://coveralls.io/repos/github/davideast/Querybase/badge.svg?branch=master)](https://coveralls.io/github/davideast/Querybase?branch=master)\n\n#### Querybase is in an experiment and not for production apps/sites/anything.\n\n## [Cloud Firestore](https://firebase.google.com/docs/firestore/) makes this library irrelevant as it has much more complex querying.\n\n## What is Querybase?\n\n- **.where()** - Find records by up to three fields.\n- **No client-side filtering** - Querybase genererates composite keys to provide querying on multiple fields.\n- **Simple Query API** - Use common query methods such as `.greaterThan()`, `.lessThan()`, and `.startsWith()`.\n- **Lightweight** - 1.87 kB (gzipped)\n\n## Install\n\n```bash\nnpm install querybase --save\n```\n\nUse via [unpkg](https://unpkg.com)\n\n```html\n\u003cscript src=\"https://unpkg.com/querybase@0.6.0\"\u003e\u003c/script\u003e\n```\n\n## Example usage\n\nQuerybase takes a Firebase Database reference with a list of fields to create composite keys. **You can only use up to three fields**. Any more would create a crazy amount of composite keys in the database.\n\n### Querying using multiple fields\n\n```js\n const databaseRef = firebase.database().ref().child('people');\n const querybaseRef = querybase.ref(databaseRef, ['name', 'age', 'location']);\n \n // Automatically handles composite keys\n querybaseRef.push({ \n   name: 'David',\n   age: 27,\n   location: 'SF'\n });\n \n// Find records by multiple fields\n// returns a Firebase Database ref\nconst queriedDbRef = querybaseRef\n  .where({\n    name: 'David',\n    age: 27\n  });\n  \n // Listen for realtime updates\n queriedDbRef.on('value', snap =\u003e console.log(snap));\n ```\n \n### Querying using one field\n\nQuerybase also provides rich querying methods for single fields.\n \n ```js\n const databaseRef = firebase.database.ref().child('people');\n const querybaseRef = querybase.ref(databaseRef, []);\n // Querybase for single criteria, returns a Firebase Ref\n querybaseRef.where({ name: 'David'});\n  \n // Querybase for a single string criteria, returns\n // a QuerybaseQuery, which returns a Firebase Ref\n querybaseRef.where('name').startsWith('Da');\n querybaseRef.where('age').lessThan(30);\n querybaseRef.where('age').greaterThan(20);\n querybaseRef.where('age').between(20, 30);\n ```\n","funding_links":[],"categories":["TypeScript","Helpers"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideast%2FQuerybase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavideast%2FQuerybase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavideast%2FQuerybase/lists"}