0

I have a Meteor project which I have unfortunately been forced to modify to use PostgreSQL instead of MongoDB, through the package meteorsteam:meteor-postgres. I have managed to get everything sorta working, except the users collection, which appears to be welded together with Meteor.

Is it possible to use some other collection for it?

I have tried replacing it with an in-memory-collection Meteor.users = new Meteor.Collection(null), and hooking up some logic to sync it with a psql table. This messes up the built-in publish-functions, since the collection doesn't have a name.

There will not be a lot of users, so having the whole thing in memory as a meteorcollection is not a problem.

I have searched around the internet, but couldn't find anything even mentioning it.

Suggestions?

Suppen
  • 836
  • 1
  • 6
  • 21
  • Could you [use mongoDB](http://stackoverflow.com/questions/20535755/using-multiple-mongodb-databases-with-meteor-js/20537457#20537457) just for the `users` table? – SylvainB Jun 09 '15 at 13:06
  • MongoDB is not an option at all, unfortunately... – Suppen Jun 10 '15 at 06:46

1 Answers1

0

If you can, an easy solution is to use MongoDB just for your users table:

if (Meteor.isServer) {
  var database = new MongoInternals.RemoteCollectionDriver("mongodb://127.0.0.1:27017/your_mongodb_base");
  Meteor.users = new Mongo.Collection("users", { _driver: database });
}

Actually, since meteor-postgres does not use Mongo.Collection but SQL.Collection, you may even get away with just:

if (Meteor.isServer) {
  Meteor.users = new Mongo.Collection("users");
}
SylvainB
  • 4,765
  • 2
  • 26
  • 39