Skip to content

chhib/meteor-mongo-slow

Repository files navigation

Mongo slow methods

Extends Mongo.Collection on the server with slow methods:

  • slowRemove(selector, chunk, delay)

The slow approach is to allow the oplog replication to catch up when managing large amounts of documents. Based on this blog post from Compose: Going Slow for Performance

Installation

To install the package simply type:

meteor add chhib:mongo-slow

Usage

HugeCollection = new Mongo.Collection('huge_collection');

// Removing 1 M docs from a collection, it is unwise to use HugeCollection.remove();
// Use HugeCollection.slowRemove() instead!
var selector = {}; // Which documents to remove
var chunk = 1000;  // Remove 1000 documents
var delay = 5000;  // every 5 second

HugeCollection.slowRemove(selector, chunk, delay);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published