npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@codesignal/meteor-protomongo

v3.1.1-beta.4

Published

Extends meteor/mongo with handy async methods

Downloads

42

Readme

@codesignal/meteor-protomongo npm version

Monkey-patches to meteor/mongo.

Helpful for working with indexes and transitioning away from Fibers.

Update, November 2022:

Meteor 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

Since 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.

Now, the package only includes helpers related to working with indexes or aggregation.

Description

This 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.

API

Collection Prototype

Collection.updateManyAsync(selector, modifier, ?options);

Same as Collection.updateAsync; passes { multi: true } in addition to the passed options.

Collection.getIndexes();

Returns 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:

[{ v: 2, key: { _id: 1 }, name: '_id_', ns: 'meteor.users' }]
Collection.ensureIndex(selector, options);

Ensures 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.

Collection.ensureNoIndex(selector);

The 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.

Collection.aggregate(pipeline, ?options);

Exposes the aggregate method. This removes the need to use rawCollection() every time you want to aggregate.

Install

npm install @codesignal/meteor-protomongo

After the package is installed, add the following few lines in a file that's going to be loaded on startup:

import { Mongo } from 'meteor/mongo';
import ProtoMongo from '@codesignal/meteor-protomongo';

ProtoMongo.extendCollection(Mongo);

Building Locally

After checking out this repo, run...

npm install
npm run build

To do local checks:

npm run eslint

Contributing

If you'd like to make a contribution, please open a pull request in package repository.

If you want (and have the right permissions) to publish a new version, please follow the instructions below:

  • Make sure you have NPM account and are a member of codesignal organization;
  • Follow instructions from npm docs to set up NPM user in your local environment;
  • Update package version and push changes to git by running these commands: npm version <new_version>, git push origin master, git push --tags;
  • Publish the updated package with npm publish --access public.

License

MIT