If you just want to use the testing
database, you can overwrite the MONGO_URL
environment variable before calling your app, for example (use the correct url to your database):
$ export MONGO_URL=mongodb://localhost:27017/testing
$ meteor
If you want to use different databases within your app, you should use the new _driver parameter. Just use the same mongo url as your default database, but replacing the database name!
// this replace is just for explicit demonstration. Static string is advised
var mongo_url = process.env.MONGO_URL.replace("/admin","/testing");
var testing = new MongoInternals.RemoteCollectionDriver(mongo_url);
Test = new Mongo.Collection("testCollection", { _driver: testing });
As for capped collections, it was answered properly in this meteor issue and fixed by this commit:
col1 = new Meteor.Collection("myCollection");
coll._createCappedCollection(numBytes, maxDocuments);
To my knowledge, you cannot uncap a previously capped collection.
Note that for these methods to work, you will have to dissociate collection creations between server and client, since clients cannot access your server's databases. In the client, just create your collections as usual, with the same name as the server version:
if (Meteor.isServer) {
var testing = new MongoInternals.RemoteCollectionDriver("<mongo url testing>");
Test = new Mongo.Collection("testCollection", { _driver: testing });
Test._createCappedCollection(2000000, 500); // capped to 2,000,000 Bytes, 500 documents
}
else {
Test = new Meteor.Collection("testCollection");
}