Counters = new Mongo.Collection('MCounters');

MCounters = MCounters || {};

var getNextSequence = function(collection) {

	// if collection doesn't exist, create the first sequence with 1 and return it
	var counter = Counters.findOne({collection: collection});

	if (!counter) {
		Counters.insert({
			collection: collection,
			seq: 1
		});
	} else {
		Counters.upsert({
			collection: collection
		}, {
			$inc: {seq: 1}
		});
	}

	return Counters.findOne({collection: collection}).seq;
};

MCounters.getNextSequence = getNextSequence;
@@ -1,16 +1,23 @@
+Meteor.
 Counters = new M
@@ -218,16 +218,23 @@
 unter = 
+Meteor.
 Counters
@@ -285,24 +285,31 @@
 ounter) %7B%0A%09%09
+Meteor.
 Counters.ins
@@ -369,16 +369,23 @@
 lse %7B%0A%09%09
+Meteor.
 Counters
@@ -387,20 +387,20 @@
 nters.up
-sert
+date
 (%7B%0A%09%09%09co
@@ -463,16 +463,23 @@
 %09return 
+Meteor.
 Counters

attach collection to Meteor global for tinytest