{"id":19458489,"url":"https://github.com/postgrespro/monq","last_synced_at":"2025-04-25T06:30:26.974Z","repository":{"id":149601033,"uuid":"96901526","full_name":"postgrespro/monq","owner":"postgrespro","description":"MonQ - PostgreSQL extension for MongoDB-like queries to jsonb data","archived":false,"fork":false,"pushed_at":"2017-07-12T11:59:59.000Z","size":37,"stargazers_count":17,"open_issues_count":1,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-24T10:48:42.003Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/postgrespro.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":"2017-07-11T14:19:03.000Z","updated_at":"2024-05-24T17:32:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"846f6d3c-cbe7-4f26-a736-4538cf419255","html_url":"https://github.com/postgrespro/monq","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/postgrespro%2Fmonq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fmonq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fmonq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postgrespro%2Fmonq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postgrespro","download_url":"https://codeload.github.com/postgrespro/monq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250766953,"owners_count":21483894,"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-10T17:27:18.227Z","updated_at":"2025-04-25T06:30:26.958Z","avatar_url":"https://github.com/postgrespro.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## MonQ \npostgreSQL extension for MongoDB query support\n\n### Introduction\n\nMonQ – is a postgreSQL extension which allow use mongoDB query language\nto query jsonb data type, introduced in PostgreSQL release 9.4.\n\nThe main task of this extension is to provide apportunity to make \nqueries on mongodb query language, translate their in to jsquery query\nlanguage and return result of them. \n\nMonQ is released as mquery data type and \u003c=\u003e match operator for jsonb.\n\n### Availability\n\nMonQ is realized as an extension and not available in default PostgreSQL\ninstallation. It is available from\n[github](https://github.com/postgrespro/MonQ)\nand supports PostgreSQL 9.4+.\n\n### Installation\n\nMonQ is PostgreSQL extension which requires JsQuery extension \n[github](https://github.com/postgrespro/jsquery) and PostgreSQL 9.4 or higher.\n\nBefore build and install you should ensure following:\n    \n * PostgreSQL version is 9.4 or higher.\n * Installed JsQuery extension.\n * You have development package of PostgreSQL installed or you built\n   PostgreSQL from source.\n * You have flex and bison installed on your system. \n * Your PATH variable is configured so that pg\\_config command available, \n or set PG_CONFIG variable.\n    \nTypical installation procedure may look like this:\n    \n    $ git clone https://github.com/nikitos94/monq.git\n    $ cd monq\n    $ make USE_PGXS=1\n    $ sudo make USE_PGXS=1 install\n    $ make USE_PGXS=1 installcheck\n    $ psql DB -c \"CREATE EXTENSION monq;\"\n\n### Usage\n\nMonQ extension contains:\n* `mquery` - datatype which represents MongoDB query in tree structure;\n* `\u003c=\u003e` - maching operator which take like arguments jsonb document and \nmongoDB query. This operator have 2 variants of representation: \n`jsonb \u003c=\u003e mquery` and `mquery \u003c=\u003e jsonb`.\n\nExample of query:\n\n```\nselect '{ \"a\" : [ \"ssl\",\"security\", \"pattern\"] }'::jsonb \u003c=\u003e\n'{ a: { $all: [ \"ssl\",\"security\"] } }'::mquery;\n```\n\nThis mongoDB query:\n\n```\n{ a: { $all: [ \"ssl\",\"security\"] } }\n```\n\ntransformed to this JsQuery query:\n\n```\na @\u003e [ \"ssl\",\"security\"]\n```\nand passed like arguments to JsQuery execution functions with jsonb document. \nExecution function return `true` or `false`dependently of result.\n\n```\n ?column? \n----------\n t\n(1 row)\n```\n\nYou cah use key `a` without quotes, but if it complicated key `\"a.b.c.qwerty.d\"`\nyou need to use them. \n\n\n### MongoDB operators supported by MonQ\n\nMonQ is limited by opportunities JsQuery language, but support main \npart of MongoDB query operators.\n\n#### Comparison operators:\n* `$eq` - supported;\n* `$ne` - supported;\n* `$lt` - supported;\n* `$lte` - supported;\n* `$gt` - supported;\n* `$gte` - supported;\n* `$in` - supported;\n* `$nin` - supported.\n\n#### Logical operators:\n* `$and` - supported;\n* `$or` - supported;\n* `$not` - supported;\n* `$nor` - supported.\n\n#### Element operators:\n* `$exists` - supported;\n* `$type` - supported.\n\n#### Evaluation operators:\n* `$mod` - not supported;\n* `$regex` - not supported;\n* `$text` - supported;\n* `$where` - not supported.\n\n#### Bitwise operators:\n* All operators are not supported.\n\n#### Array operators:\n* `$all` - supported;\n* `$elemMatch` - supported;\n* `$size` - supported.\n\n#### Comment operators:\n* All operators are not supported.\n\n#### Geospatial operators:\n* All operators are not supported.\n\n#### Projextion operators:\n* All operators are not supported.\n\nExamples of queries with all this operators you can find in the file \n[sql/sql_test.sql](https://github.com/postgrespro/MonQ/blob/master/sql/monq_test.sql)\n\n### Contribution\n\nPlease, notice, that MonQ is still under development and while it's stable\nand tested, it may contains some bugs. Don't hesitate to raise issues at \ngithub with your bug reports.\n\nIf you're lacking of some functionality in MonQ and feeling power to \nimplement it then you're welcome to make pull requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fmonq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostgrespro%2Fmonq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostgrespro%2Fmonq/lists"}