0.0.6 • Published 6 years ago

odata-v4-filter-parser v0.0.6

Weekly downloads
71
License
MIT
Repository
github
Last release
6 years ago

odata-v4-filter-parser is a JS parser which parses OData V4 $filter syntax in URL into MongoDB syntax.

See

Usage

const { parse } = require('odata-v4-filter-parser');

parse("(status eq Enum.Status'ACTIVE' or status eq Enum.Status'DELETED') and id eq 11 and contains(text, 'aa') and (score/overall gt 123) and isof(data, Model.DevcieData)");

results in

{
  "$and": [
    {
      "$or": [
        {
          "status": {
            "$eq": "ACTIVE"
          }
        },
        {
          "status": {
            "$eq": "DELETED"
          }
        }
      ]
    },
    {
      "id": {
        "$eq": 11
      }
    },
    {
      "text": {
        "$regex": ".*aa.*"
      }
    },
    {
      "score.overall": {
        "$gt": 123
      }
    },
    {
      "data": {
        "$type": "Model.DevcieData"
      }
    }
  ]
}

Issue Reporting

If you have found a bug or if you have a feature request, please report them at this repository issues section.

License

This project is licensed under the MIT license.

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago