{"id":21822016,"url":"https://github.com/nathanadhitya/express-mongoose-ra-json-server","last_synced_at":"2026-03-06T16:33:34.489Z","repository":{"id":57750749,"uuid":"525322045","full_name":"NathanAdhitya/express-mongoose-ra-json-server","owner":"NathanAdhitya","description":"creates express.js routes from a mongoose model for ra-data-json-server","archived":false,"fork":false,"pushed_at":"2023-07-24T15:33:05.000Z","size":173,"stargazers_count":19,"open_issues_count":3,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T17:51:48.004Z","etag":null,"topics":["react-admin"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NathanAdhitya.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-16T09:57:54.000Z","updated_at":"2024-07-10T06:42:29.000Z","dependencies_parsed_at":"2024-06-21T20:25:11.735Z","dependency_job_id":"3c491fb7-7ffd-487c-83d7-e0b7ceea5f65","html_url":"https://github.com/NathanAdhitya/express-mongoose-ra-json-server","commit_stats":{"total_commits":11,"total_committers":2,"mean_commits":5.5,"dds":0.09090909090909094,"last_synced_commit":"0d24f5e46f574c3b6ce0f0e61caedbf682732953"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanAdhitya%2Fexpress-mongoose-ra-json-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanAdhitya%2Fexpress-mongoose-ra-json-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanAdhitya%2Fexpress-mongoose-ra-json-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanAdhitya%2Fexpress-mongoose-ra-json-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NathanAdhitya","download_url":"https://codeload.github.com/NathanAdhitya/express-mongoose-ra-json-server/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248819353,"owners_count":21166474,"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":["react-admin"],"created_at":"2024-11-27T17:12:21.010Z","updated_at":"2026-03-06T16:33:34.445Z","avatar_url":"https://github.com/NathanAdhitya.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# express-mongoose-ra-json-server\n\n[![npm](https://img.shields.io/npm/v/express-mongoose-ra-json-server)](https://www.npmjs.com/package/express-mongoose-ra-json-server)\n\nCreate express.js routes from a mongoose model for ra-data-json-server. Very useful for rapid prototyping with MongoDB, Mongoose, and [react-admin](https://github.com/marmelab/react-admin).  \nExample/demo project is available here: [express-mongoose-ra-json-server-demo](https://github.com/NathanAdhitya/express-mongoose-ra-json-server-demo)\n\n## Installation\n\nNPM: `npm add express-mongoose-ra-json-server`  \nYarn: `yarn add express-mongoose-ra-json-server`  \nPNPM: `pnpm add express-mongoose-ra-json-server`\n\n### Client Usage\n\n```ts\nimport jsonServerProvider from \"ra-data-json-server\"; // Use ra-data-json-server\nconst apiUrl = \"api/admin\"; // Fill this in with your own URL or whatever you wish.\nconst dataProvider = jsonServerProvider(apiUrl, httpClient);\n```\n\n## Usage\n\nRefer to the typescript definitions in [index.ts](src/index.ts) for a more complete information.\n\n### Basic Usage\n\n```ts\nimport raExpressMongoose from \"express-mongoose-ra-json-server\";\nrouter.use(\"/user\", raExpressMongoose(userModel));\n```\n\n### More Configuration Options\n\nPass in the options as a second parameter to the function.  \nThe currently exported typedefs contain just enough comments to describe what they do.\n\n```ts\nexport interface raExpressMongooseOptions\u003cT\u003e {\n  /** Fields to search from ?q (used for autofill and search) */\n  q?: string[];\n\n  /** Base name for ACLs (e.g. list operation does baseName.list) */\n  aclName?: string;\n\n  /** Fields to allow regex based search (non-exact search) */\n  allowedRegexFields?: string[];\n\n  /** Regex flags for regex-based search */\n  regexFlags?: string;\n\n  /** Read-only fields to filter out during create and update */\n  readOnlyFields?: string[];\n\n  /** Function to transform inputs received in create and update */\n  inputTransformer?: (input: Partial\u003cT\u003e) =\u003e Promise\u003cPartial\u003cT\u003e\u003e;\n\n  /** Additional queries for list, e.g. deleted/hidden flag. */\n  listQuery?: Record\u003cstring, any\u003e;\n\n  /** Max rows from a get operation to prevent accidental server suicide (default 100) */\n  maxRows?: number;\n\n  /** Extra selects for mongoose queries (in the case that certain fields are hidden by default) */\n  extraSelects?: string;\n\n  /** Disable or enable certain parts. */\n  capabilities?: raExpressMongooseCapabilities;\n\n  /** Specify a custom express.js router */\n  router?: Router;\n\n  /** Should all queries use lean? (default = true) */\n  useLean?: boolean;\n\n  /** Specify an ACL middleware to check against permissions */\n  ACLMiddleware?: (name: string) =\u003e RequestHandler;\n}\n```\n\n## Query Operators\n\nMongoDB Query Operators can be used by appending them as a suffix to the field name ([see here](https://marmelab.com/react-admin/FilteringTutorial.html#filter-operators)).\n\n### Supported Operators\n\n| MongoDB Query Operator | Field Suffix | Description                                                                                                                                                                   |\n| ---------------------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| $eq                    | \\_eq         | Matches values that are equal to a specified value. \u003cbr/\u003e (Useful for matching exact values if a field is included in allowedRegexFields) \u003cbr/\u003e Example: `/user?name_eq=Alex` |\n| $gt                    | \\_gt         | Matches values that are greater than a specified value. \u003cbr/\u003e Example: `/user?createdAt_gt=2022-10-25T00%3A00%3A00.000Z`                                                      |\n| $gte                   | \\_gte        | Matches values that are greater than or equal to a specified value. \u003cbr/\u003e Example: `/user?createdAt_gte=2022-10-25T00%3A00%3A00.000Z`                                         |\n| $in                    | \\_in         | Matches any of the values specified in an array. \u003cbr/\u003e Example: `/user?name_in=Alex\u0026name_in=Peter`                                                                            |\n| $lt                    | \\_lt         | Matches values that are less than a specified value. \u003cbr/\u003e Example: `/user?createdAt_lt=2022-10-25T00%3A00%3A00.000Z`                                                         |\n| $lte                   | \\_lte        | Matches values that are less than or equal to a specified value. \u003cbr/\u003e Example: `/user?createdAt_lte=2022-10-25T00%3A00%3A00.000Z`                                            |\n| $ne                    | \\_ne         | Matches all values that are not equal to a specified value. \u003cbr/\u003e Example: `/user?name_ne=Alex`                                                                               |\n| $nin                   | \\_nin        | Matches none of the values specified in an array. \u003cbr/\u003e Example: `/user?name_nin=Alex\u0026name_nin=Peter`                                                                         |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanadhitya%2Fexpress-mongoose-ra-json-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanadhitya%2Fexpress-mongoose-ra-json-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanadhitya%2Fexpress-mongoose-ra-json-server/lists"}