{"id":24418698,"url":"https://github.com/thecodedrift/mongonna","last_synced_at":"2025-07-01T13:07:55.264Z","repository":{"id":139335806,"uuid":"555188277","full_name":"thecodedrift/mongonna","owner":"thecodedrift","description":"When You're Gonna use HTTPS for MongoDB","archived":false,"fork":false,"pushed_at":"2022-10-21T07:23:22.000Z","size":63,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-30T04:56:33.639Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodedrift.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-21T05:19:44.000Z","updated_at":"2022-10-21T05:31:38.000Z","dependencies_parsed_at":null,"dependency_job_id":"3ab90b90-fef8-43f2-8f46-98ac1234709a","html_url":"https://github.com/thecodedrift/mongonna","commit_stats":null,"previous_names":["thecodedrift/mongonna"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/thecodedrift/mongonna","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fmongonna","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fmongonna/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fmongonna/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fmongonna/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodedrift","download_url":"https://codeload.github.com/thecodedrift/mongonna/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodedrift%2Fmongonna/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262969885,"owners_count":23392530,"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":"2025-01-20T09:11:29.121Z","updated_at":"2025-07-01T13:07:55.239Z","avatar_url":"https://github.com/thecodedrift.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mongonna\n\nServerless MongoDB. What are you ... mongonna do about it?\n\n_naming things is hard_\n\n# Why\n\nAtlas App Service leaves a lot to be desired. If you're using Mongo, you just kind of wanted to use Mongo the way it was intended! Mongonna looks like \u0026 acts like a regular node.js MongoDB client with a catch- the first parameter is a proxy server that will receive your Mongo command and execute it.\n\n# How\n\nES6 Proxies. And some TypeScript magic. Chain it all together, tell Mongonna about your Mongo Client, because it's a peer dependency and its your types. We're just the chaining and RPC call.\n\n```ts\nconst client = new MongonnaClient\u003cMongoClient\u003e( // \u003c= Tell us your MongoClient typings\n  \"http://localhost:3000\", // \u003c= who should we talk to\n  \"SUPER_SECRET_SERVER_1\" // \u003c= this can be an opaque identifier or real mongo URL\n);\nawait client.db(\"foo\").collection(\"bar\").find({ a: 1 }).toArray();\n//           ^         ^                 ^              ^\n//            \\        |                 |             /\n//              \\       \\                |            /\n//                  Every 👏🏻 Call 👏🏻 Is 👏🏻 Typed\n```\n\n# Receiving the RPC\n\nIt's up to you. You'll get a payload at your url containing\n\n```ts\ninterface MongonnaRequest {\n  url: string; // \u003c= self referentia\u003e\n  mongoUrl: string; // \u003c= That identifier from above or a full mongo URL\n  options: MongonnaClientOptions; // \u003c= The client options object\n  chain: MongonnaStack; // \u003c= The chain of calls to execute\n}\n```\n\nYou can then call `applyMongonna` wih your client \u0026 chain object, and we reflect those calls onto the `MongoClient` you give us. The resulting object contains the `data` result from the call, or a serialized `error` object that can be returned. Send the whole chunk back as JSON!\n\n```ts\nconst { data, error } = await applyMongonna(client, chain);\nsendJson(200, { data, error }); // status code 200. The call worked, errors will be rethrown locally\n```\n\n# Caveats\n\nCursors are awkward, because in a stateless world. `next()` would always resolve the same. There's no easy fix for that, but if you're using `toArray()` and smart queries, it can be worked around.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fmongonna","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodedrift%2Fmongonna","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodedrift%2Fmongonna/lists"}