{"id":13420938,"url":"https://github.com/DataIntellectTech/mongoq","last_synced_at":"2025-03-15T07:32:09.450Z","repository":{"id":27730400,"uuid":"31217924","full_name":"DataIntellectTech/mongoq","owner":"DataIntellectTech","description":"A C shared lib along with associated q functions to allow push/pull access to mongoDB from within kdb+","archived":false,"fork":false,"pushed_at":"2015-03-19T11:07:06.000Z","size":165,"stargazers_count":15,"open_issues_count":1,"forks_count":4,"subscribers_count":47,"default_branch":"master","last_synced_at":"2024-12-06T21:05:32.030Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DataIntellectTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-23T16:47:39.000Z","updated_at":"2024-08-29T07:14:15.000Z","dependencies_parsed_at":"2022-08-24T16:21:29.662Z","dependency_job_id":null,"html_url":"https://github.com/DataIntellectTech/mongoq","commit_stats":null,"previous_names":["dataintellecttech/mongoq","aquaqanalytics/mongoq"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataIntellectTech%2Fmongoq","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataIntellectTech%2Fmongoq/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataIntellectTech%2Fmongoq/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DataIntellectTech%2Fmongoq/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DataIntellectTech","download_url":"https://codeload.github.com/DataIntellectTech/mongoq/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243701276,"owners_count":20333615,"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-07-30T22:01:44.542Z","updated_at":"2025-03-15T07:32:09.170Z","avatar_url":"https://github.com/DataIntellectTech.png","language":"C","readme":"# mongoq\n\n## About\nA C shared lib along with associated q functions to allow push/pull access to mongoDB from within kdb+\n\n## Installation\n\n- Install the mongo c driver libraries | [repo](https://github.com/mongodb/mongo-c-driver) | [instructions](https://github.com/mongodb/mongo-c-driver/blob/master/TUTORIAL.md)\n- Clone the mongoq git repo\n- Compile shared object using platform specific instructions below\n\n###### Linux (64 bit)\n```\ngcc -o mongoq.so mongoq.c $(pkg-config --cflags --libs libmongoc-1.0) -I./ -shared -fPIC\n```\n###### Windows\n```\nCL /DWIN32 /I C:\\usr\\include\\libbson-1.0 /I C:\\usr\\include\\libmongoc-1.0 /LIBPATH C:\\usr\\lib\\bson-1.0.lib /LIBPATH C:\\usr\\lib\\mongoc-1.0.lib /LD mongoq.c q.lib /DEF mongoq.def\n```\n\n- copy the shared library file from the bin folder to the location of your q executable - e.g. $QHOME/l32\n- copy mongo.q to $QHOME\n\n## Usage\n\n#### Load and initialise library\n\nThis assumes there is a MongoDB server running on the local machine on the standard port - amend the connection details as required for your MongoDB setup\n```\n\\l mongo.q\n.mg.init[`localhost;27017;`kdb]\n```\n\n#### Insert data to MongoDB\n\n```\nq).mg.add[`test] `a`b`c!(1;`xyz;12t) / single record\n00000000-54ef-b9bd-dfa8-32369e099741\nq)r:.mg.add[`test] ([]time:3 4t;sym:`IBM`MSFT;price:23.4 56.7) / table\n```\n\n#### Query data from MongoDB\n\nThe '.mg.add' function returns a 16 byte UID type, which maps to the MongoDB ObjectID key of the inserted record. We can use these ids to retrieve data:\n```\nq).mg.find[`test;;()] r / all fields for id(s) r in table 'test'\ntime           sym    price\n---------------------------\n\"03:00:00.000\" \"IBM\"  23.4\n\"04:00:00.000\" \"MSFT\" 56.7\nq).mg.find[`test;;`sym`price] r / only sym \u0026 price fields\nsym    price\n------------\n\"IBM\"  23.4\n\"MSFT\" 56.7\n```\n\n## Examples\n\n- [Comments database](examples/COMMENTS.md)\n\n","funding_links":[],"categories":["TODO scan for Android support in followings"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataIntellectTech%2Fmongoq","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FDataIntellectTech%2Fmongoq","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FDataIntellectTech%2Fmongoq/lists"}