{"id":20540430,"url":"https://github.com/codesignal/meteor-protomongo","last_synced_at":"2025-04-14T08:37:29.356Z","repository":{"id":37963925,"uuid":"148221747","full_name":"CodeSignal/meteor-protomongo","owner":"CodeSignal","description":"Extensions to Meteor's Mongo.Collection prototype","archived":false,"fork":false,"pushed_at":"2025-01-14T11:07:28.000Z","size":2393,"stargazers_count":6,"open_issues_count":10,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-10T16:16:52.530Z","etag":null,"topics":["insert","meteor","meteor-protomongo","promise","upsert"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/CodeSignal.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":"2018-09-10T21:32:05.000Z","updated_at":"2025-01-14T11:07:29.000Z","dependencies_parsed_at":"2023-02-10T09:35:26.606Z","dependency_job_id":"8eb422e7-fc62-4607-a00f-15ae3aaf0a0e","html_url":"https://github.com/CodeSignal/meteor-protomongo","commit_stats":{"total_commits":432,"total_committers":6,"mean_commits":72.0,"dds":0.5532407407407407,"last_synced_commit":"1a42565f2151cc96a2c6629daf5e739b50433c50"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSignal%2Fmeteor-protomongo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSignal%2Fmeteor-protomongo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSignal%2Fmeteor-protomongo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CodeSignal%2Fmeteor-protomongo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CodeSignal","download_url":"https://codeload.github.com/CodeSignal/meteor-protomongo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248847027,"owners_count":21171077,"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":["insert","meteor","meteor-protomongo","promise","upsert"],"created_at":"2024-11-16T01:15:19.289Z","updated_at":"2025-04-14T08:37:29.331Z","avatar_url":"https://github.com/CodeSignal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"@codesignal/meteor-protomongo\u003cbr\u003e[![](http://img.shields.io/npm/dm/@codesignal/meteor-protomongo.svg?style=flat)](https://www.npmjs.com/package/@codesignal/meteor-protomongo) [![npm version](https://badge.fury.io/js/%40codesignal%2Fmeteor-protomongo.svg)](https://www.npmjs.com/package/@codesignal/meteor-protomongo)\n=\n\n**Monkey-patches to `meteor/mongo`.**\n\n*Helpful for working with indexes and transitioning away from Fibers.*\n\n**Update, November 2022:**\n\nMeteor 2.8 updated the core `meteor/mongo` package to add `*Async` versions of Mongo methods by default. See: https://github.com/meteor/meteor/pull/11605\n\nSince the new core methods have identical signatures to the ones previously provided by this package, the 3.x release of this package has been updated to remove the overlapping methods.\n\nNow, the package only includes helpers related to working with indexes or aggregation.\n\n## Description\n\nThis package extends the `Collection` prototype from `meteor/mongo` with a few handy helpers related to indexes and aggregation. It's intended for use only with projects built with [Meteor](https://www.meteor.com/).\n\n### API\n\n#### Collection Prototype\n\n```js\nCollection.updateManyAsync(selector, modifier, ?options);\n```\n\nSame as `Collection.updateAsync`; passes `{ multi: true }` in addition to the passed `options`.\n\n```js\nCollection.getIndexes();\n```\n\nReturns a Promise that is resolved with an array of indexes for this collection. For example, you might see this for a users collection with only an index on ID:\n```js\n[{ v: 2, key: { _id: 1 }, name: '_id_', ns: 'meteor.users' }]\n```\n\n```js\nCollection.ensureIndex(selector, options);\n```\n\nEnsures an index exists. Similar to the built-in `createIndex`, but handles the case where the index already exists with different options by removing and re-adding the index with the new options. To ensure your database has the same indexes across different environments, you might want to add `ensureIndex` calls to `Meteor.startup`.\n\n```js\nCollection.ensureIndexAsync(selector, options);\n```\n\nSimilar to `ensureIndex`, but returns a Promise that is resolved when the index is created. This method is compatible with Meteor 3.0.\n\n```js\nCollection.ensureNoIndex(selector);\n```\n\nThe reverse of `ensureIndex`. You might want to call this in `Meteor.startup` to make sure an index has been removed in all of your deployed environments.\n\n```js\nCollection.ensureNoIndexAsync(selector);\n```\n\nSimilar to `ensureNoIndex`, but returns a Promise that is resolved when the index is dropped. This method is compatible with Meteor 3.0.\n\n```js\nCollection.aggregate(pipeline, ?options);\n```\n\nExposes the [aggregate method](https://www.mongodb.com/docs/manual/reference/method/db.collection.aggregate/). This removes the need to use `rawCollection()` every time you want to aggregate.\n\n## Install\n\n```bash\nnpm install @codesignal/meteor-protomongo\n```\n\nAfter the package is installed, add the following few lines in a file that's going to be loaded on startup:\n```js\nimport { Mongo } from 'meteor/mongo';\nimport ProtoMongo from '@codesignal/meteor-protomongo';\n\nProtoMongo.extendCollection(Mongo);\n```\n\n## Building Locally\n\nAfter checking out this repo, run...\n\n```sh\nnpm install\nnpm run build\n```\n\nTo do local checks:\n```sh\nnpm run eslint\n```\n\n## Contributing\n\nIf you'd like to make a contribution, please open a pull request in [package repository](https://github.com/CodeSignal/meteor-protomongo).\n\nIf you want (and have the right permissions) to publish a new version, please follow the instructions below:\n* Make sure you have [NPM](https://www.npmjs.com/) account and are a member of [codesignal](https://www.npmjs.com/org/codesignal) organization;\n* Follow instructions from [npm docs](https://docs.npmjs.com/getting-started/publishing-npm-packages) to set up NPM user in your local environment;\n* Update package version and push changes to git by running these commands: `npm version \u003cnew_version\u003e`, `git push origin master`, `git push --tags`;\n* Publish the updated package with `npm publish --access public`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesignal%2Fmeteor-protomongo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodesignal%2Fmeteor-protomongo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodesignal%2Fmeteor-protomongo/lists"}