{"id":20494060,"url":"https://github.com/jaystack/odata-v4-mongodb","last_synced_at":"2025-07-11T06:37:54.039Z","repository":{"id":56031956,"uuid":"56063921","full_name":"jaystack/odata-v4-mongodb","owner":"jaystack","description":"This server component lets you process OData requests over a MongoDB database","archived":false,"fork":false,"pushed_at":"2020-11-30T05:25:04.000Z","size":33,"stargazers_count":29,"open_issues_count":4,"forks_count":22,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-05-21T01:12:27.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/jaystack.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":"2016-04-12T13:07:42.000Z","updated_at":"2024-02-11T00:18:35.000Z","dependencies_parsed_at":"2022-08-15T11:50:25.543Z","dependency_job_id":null,"html_url":"https://github.com/jaystack/odata-v4-mongodb","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-mongodb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-mongodb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-mongodb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jaystack%2Fodata-v4-mongodb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jaystack","download_url":"https://codeload.github.com/jaystack/odata-v4-mongodb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248750854,"owners_count":21155795,"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":[],"created_at":"2024-11-15T17:38:05.595Z","updated_at":"2025-04-13T17:21:49.982Z","avatar_url":"https://github.com/jaystack.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OData V4 Service modules - MongoDB Connector\n\nService OData v4 requests from a MongoDB data store.\n\n## Synopsis\nThe OData V4 MongoDB Connector provides functionality to convert the various types of OData segments\ninto MongoDB query objects, that you can execute over a MongoDB database.\n\n## Potential usage scenarios\n\n- Create high speed, standard compliant data sharing APIs\n\n## Usage as server - TypeScript\n```javascript\nimport { createFilter } from 'odata-v4-mongodb'\n\n//example request:  GET /api/products?$filter=category/id eq 5 or color eq 'Red'\napp.get(\"/api/products\", (req: Request, res: Response) =\u003e {\n    const filter = createFilter(req.query.$filter);\n    // collection instance from MongoDB Node.JS Driver\n    collection.find(filter, function(err, data){\n        res.json({\n        \t'@odata.context': req.protocol + '://' + req.get('host') + '/api/$metadata#products',\n        \tvalue: data\n        });\n    });\n});\n```\n\n## Usage ES5\n```javascript\nvar createFilter = require('odata-v4-mongodb').createFilter;\n\napp.get(\"/api/products\", function(req, res) {\n    var filter = createFilter(req.query.$filter);\n    // collection instance from MongoDB Node.JS Driver\n    collection.find(filter, function(err, data){\n        res.json({\n        \t'@odata.context': req.protocol + '://' + req.get('host') + '/api/$metadata#products',\n        \tvalue: data\n        });\n    });\n})\n```\n\n## Supported OData segments\n\nFor now **$filter**, **$select**, **$skip** and **$top**\n\nSupport for **$expand** is next.\n\n### Supported $filter expressions\n\nThe [OData v4 Parser](https://www.npmjs.com/package/odata-v4-parser) layer supports 100% of the specification.\nThe Connector is supporting basic MongoDB queries.\n\n*We are into creating a comprehensive feature availability chart for V1 release*\n\n    √ expression 5.1.1.6.1: NullValue eq null\n    √ expression 5.1.1.6.1: TrueValue eq true\n    √ expression 5.1.1.6.1: FalseValue eq false\n    √ expression 5.1.1.6.1: IntegerValue lt -128\n    √ expression 5.1.1.6.1: DecimalValue eq 34.95\n    √ expression 5.1.1.6.1: StringValue eq 'Say Hello,then go'\n    √ expression 5.1.1.6.1: DurationValue eq duration'P12DT23H59M59.999999999999S'\n    √ expression 5.1.1.6.1: DateValue eq 2012-12-03\n    √ expression 5.1.1.6.1: DateTimeOffsetValue eq 2012-12-03T07:16:23Z\n    √ expression 5.1.1.6.1: GuidValue eq 01234567-89ab-cdef-0123-456789abcdef\n    √ expression 5.1.1.6.1: Int64Value eq 0\n    √ expression 5.1.1.6.1: A eq INF\n    √ expression 5.1.1.6.1: A eq 0.31415926535897931e1\n    √ expression 5.1.1.1.2: A ne 1\n    √ expression 5.1.1.1.3: A gt 2\n    √ expression 5.1.1.1.4: A ge 3\n    √ expression 5.1.1.1.5: A lt 2\n    √ expression 5.1.1.1.6: A le 2\n    √ expression: A/b eq 1\n    √ expression 5.1.1.3: (A/b eq 2) or (B/c lt 4) and ((E gt 5) or (E lt -1))\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaystack%2Fodata-v4-mongodb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjaystack%2Fodata-v4-mongodb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjaystack%2Fodata-v4-mongodb/lists"}