JohnAllen
JohnAllen

Reputation: 7521

How can I declare a new collection from a package?

I'm writing a Meteor package that needs to create a new collection.

NewCollection = new Mongo.Collection('newcollection'); doesn't work in package code because Mongo isn't available to the package (Mongo is not defined).

How can I create a new collection in a Meteor package?

Upvotes: 0

Views: 26

Answers (1)

Oliver
Oliver

Reputation: 4091

In your package.js file just include the mongo package:

Package.onUse(function (api) {
    api.use('mongo');
});

Upvotes: 2

Related Questions