{"id":33187875,"url":"https://github.com/thedv91/mongoolia-v5","last_synced_at":"2025-11-20T23:04:01.969Z","repository":{"id":57301919,"uuid":"187228445","full_name":"thedv91/mongoolia-v5","owner":"thedv91","description":"Keep your mongoose schemas synced with Algolia","archived":false,"fork":true,"pushed_at":"2019-05-17T18:00:26.000Z","size":192,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"upgrade-mongoose-v5","last_synced_at":"2025-05-29T10:13:35.106Z","etag":null,"topics":["mongoolia"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"algolia/mongoolia","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thedv91.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-17T14:14:33.000Z","updated_at":"2023-03-08T21:43:44.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/thedv91/mongoolia-v5","commit_stats":null,"previous_names":["thedv91/mongoolia"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thedv91/mongoolia-v5","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedv91%2Fmongoolia-v5","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedv91%2Fmongoolia-v5/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedv91%2Fmongoolia-v5/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedv91%2Fmongoolia-v5/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thedv91","download_url":"https://codeload.github.com/thedv91/mongoolia-v5/tar.gz/refs/heads/upgrade-mongoose-v5","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thedv91%2Fmongoolia-v5/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285526205,"owners_count":27186656,"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","status":"online","status_checked_at":"2025-11-20T02:00:05.334Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["mongoolia"],"created_at":"2025-11-16T05:00:34.273Z","updated_at":"2025-11-20T23:04:01.964Z","avatar_url":"https://github.com/thedv91.png","language":"JavaScript","funding_links":[],"categories":["Community libraries"],"sub_categories":[],"readme":"# mongoolia-v5\n\n\u003e Keep your [mongoosejs](http://mongoosejs.com/) schemas synced with [Algolia](http://www.algolia.com)\n\nThis plugin will automatically synchronise your models with an Algolia index every time a new document is added, updated or removed.\n\nYou can also index your whole collection if you didn't use this plugin when you started using mongoose.\n\n## How to\n\n**Only supports mongoose v5**\n\nFirst install the library:\n\n* `\u003e yarn add mongoolia-v5` OR\n* `\u003e npm add mongoolia-v5 -S`\n\nThen you need to specify which fields of your schema you want to index with Algolia and register the plugin to your mongoose model created with this schema:\n\n```js\n// ES6\nimport mongoose from 'mongoose';\nimport mongoolia from 'mongoolia-v5';\n\n// ES5\nconst mongoose = require('mongoose');\nconst mongoolia = require('mongoolia-v5').default;\n\n// Pass `{algoliaIndex: true}` to push theses attributes for indexing to Algolia\nconst BookSchema = new mongoose.Schema({\n  title: { type: String, required: true, algoliaIndex: true },\n  author: { type: String, required: true, algoliaIndex: true },\n  description: { type: String, required: true, algoliaIndex: true }\n});\n\n// Specify your Algolia credentials which you can find into your dashboard\nBookSchema.plugin(mongoolia, {\n  appId: 'xxxxx'\n  apiKey: 'xxxx',\n  indexName: 'xxxx',\n  fieldName: 'xxxx' // Optional, Default: \"_algoliaObjectID\"\n})\n```\n\n## Options\n\n| Option name  | Type     | Description\n| -            | -        | -\n| `appId*`     | `string` | The Algolia application ID\n| `apiKey*`    | `string` | The Algolia **admin** API key\n| `indexName*` | `string` | The name of the index you want to push data\n| `fieldName*` | `string` | `Default: \"_algoliaObjectID\"` The name of the field you want to save data\n\n## Methods\n\nAfter applying the `mongoolia` plugin to your mongoose model it registers new static methods:\n\n#### `Model.syncWithAlgolia({ force: boolean }): Promise`\nIndex the whole collection into your Algolia index.\n\n#### `Model.clearAlgoliaIndex(): Promise`\nClears your Algolia index and remove `fieldName` from your documents.\n\n#### `Model.setAlgoliaIndexSettings(settings: {}, forwardToReplicas: boolean): Promise`\nSet one or more settings of the Algolia index, the full settings list is available [here](https://www.algolia.com/doc/api-reference/settings-api-parameters/).\n\n#### `Model.algoliaSearch({ query: string, params?: {}, populate?: boolean }): Promise`\nSearch into your Algolia index for a specific query. You can customize the search parameters as well.\n\nYou can find the full list of search parameters [here](https://www.algolia.com/doc/api-reference/api-parameters/), you should look for settings tagged with `search`.\n\nThe server response will look like:\n\n```json\n{\n  \"hits\": [\n    {\n      \"firstname\": \"Jimmie\",\n      \"lastname\": \"Barninger\",\n      \"objectID\": \"433\",\n      \"_highlightResult\": {\n        \"firstname\": {\n          \"value\": \"\u003cem\u003eJimmie\u003c/em\u003e\",\n          \"matchLevel\": \"partial\"\n        },\n        \"lastname\": {\n          \"value\": \"Barninger\",\n          \"matchLevel\": \"none\"\n        },\n        \"company\": {\n          \"value\": \"California \u003cem\u003ePaint\u003c/em\u003e \u0026 Wlpaper Str\",\n          \"matchLevel\": \"partial\"\n        }\n      }\n    }\n  ],\n  \"page\": 0,\n  \"nbHits\": 1,\n  \"nbPages\": 1,\n  \"hitsPerPage\": 20,\n  \"processingTimeMS\": 1,\n  \"query\": \"jimmie paint\",\n  \"params\": \"query=jimmie+paint\u0026attributesToRetrieve=firstname,lastname\u0026hitsPerPage=50\"\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedv91%2Fmongoolia-v5","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthedv91%2Fmongoolia-v5","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthedv91%2Fmongoolia-v5/lists"}