{"id":13530289,"url":"https://massd.github.io/mongo/","last_synced_at":"2025-04-01T18:31:30.795Z","repository":{"id":8212616,"uuid":"9648026","full_name":"MassD/mongo","owner":"MassD","description":"An ocaml driver for mongodb","archived":false,"fork":false,"pushed_at":"2021-12-10T20:54:55.000Z","size":752,"stargazers_count":52,"open_issues_count":6,"forks_count":16,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-06T19:52:09.492Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MassD.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2013-04-24T13:28:11.000Z","updated_at":"2024-12-02T00:21:48.000Z","dependencies_parsed_at":"2022-08-06T22:01:08.795Z","dependency_job_id":null,"html_url":"https://github.com/MassD/mongo","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MassD%2Fmongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MassD%2Fmongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MassD%2Fmongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MassD%2Fmongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MassD","download_url":"https://codeload.github.com/MassD/mongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246691558,"owners_count":20818533,"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-08-01T07:00:47.457Z","updated_at":"2025-04-01T18:31:30.536Z","avatar_url":"https://github.com/MassD.png","language":"OCaml","funding_links":[],"categories":["Libraries","Databases"],"sub_categories":["OCaml"],"readme":"# Mongo.ml\n\n**Mongo.ml** is an OCaml driver for MongoDB.\n\nIt supplies a series of APIs which can be used to communicate with MongoDB, i.e., **Insert**, **Update**, **Delete** and **Query / Find**.\n\nHere is the [Mongo.ml API docs](http://massd.github.io/mongo/doc/).\n\n### Prerequisite\n\nThis driver uses **unix** and external [Bson.ml](http://massd.github.io/bson/) modules.\n\nHere is the [Bson.ml API doc](http://massd.github.io/bson/doc/Bson.html).\n\n***\n\n### How to use it\n\n**Mongo** and **MongoAdmin** are the two modules for high level usage.\n\n**Mongo** is a MongoDB client for general purpose. It can be used to operate normal bson documents on MongoDB.\n\n**MongoAdmin** is a special MongoDB client for accessing admin level of MongoDB commands, such as _list databases_, etc. Please refer to [MongoDB commands](http://docs.mongodb.org/manual/reference/command/).\n\nThe usages of these two modules are similar:\n\n1. **Mongo.create** a Mongo with ip, port, db\\_name, and collection\\_name (MongoAdmin does not need db\\_name or collection\\_name)\n2. Depending on the request type, create the Bson document using **Bson.ml**\n3. **Mongo.insert** / **Mongo.update** / **Mongo.delete** / **Mongo.find** / **Mongo.get_more** / **Mongo.kill_cursors**\n4. Only **Mongo.find** and **Mongo.get_more** will wait for a **MongoReply**. Others will finish immediately.\n5. **Mongo.destroy** the Mongo to release the resources.\n\n***\n\n### Sample usage\n\nPlease refer to **test/test_mongo.ml** for a taste of usage.\n\n\tocamlbuild -use-ocamlfind -I src test/test_mongo.native\n\t./test_mongo.native\n\n***\n\n### Extend the driver\n\nComparing to MongoDB's official drivers, **this OCaml driver is not that complete.**\n\nThis driver can be used only for **essential** operations on MongoDB, particularly with all default options/configurations.\n\nI am slowly extend this driver and **experienced OCaml/MongoDB developers are welcomed to join**.\n\n***\n\n### The source code\n\n**MongoOperation** defines all operations allowed by MongoDB.\n\n**MongoHeader** defines the header that is used in MongoDB messages. It includes encoding / decoding the MongoDB messages. When constructing a **MongoRequest**, encoding is used; when constructing a **MongoReply** from the message sent by MongoDB, decoding is used.\n\n**MongoRequest** create the message bytes (string) for all requests. The output string can be used to **MongoSend** to send to MongoDB socket. Every function inside has full parameters according to [MongoDB wire protocol](http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/).\n\n**MongoSend** takes a **unix file_descr** and a **string** and send the string to the file_descr. It uses **unix**.\n\n**MongoReply** is the type that contains the reply MongoDB.\n\n**Mongo** and **MongoAdmin** are the client-faced interfaces. They are the first places to be extended.\n\n***\n\n### Misc\n\nThe current version is **0.67.2**.\n\n### OPAM\nSince version 0.67.0, bson.ml and mongo.ml are package in opam.\n\nTo install with opam: `opam install mongo`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/massd.github.io%2Fmongo%2F","html_url":"https://awesome.ecosyste.ms/projects/massd.github.io%2Fmongo%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/massd.github.io%2Fmongo%2F/lists"}