MongoInternals.RemoteCollectionDriver to Meteor.users

I need to use 2 Mongo_URL to connect external Mongo database and one is to use to store users collection(i.e. Meteor.users).And I use the following method:

database = new MongoInternals.RemoteCollectionDriver( “mongodb://xxx.xx.x.x : xxxx/Users”);
Meteor.users = new Mongo.Collection(“users”, { _driver: database });

It comes an error : Error: A method named ‘/users/insert’ is already defined

It seems that the accounts package already created the default users collection ?

Can anyone help me if I must use MongoInternals.RemoteCollectionDriver ?
Thanks a lot !

1 Like

I also need that. :frowning:

I have the same isuue

The issue is that when you define a new Mongo.Collection, meteor automatically registers methods that are called by the client whenever there is a client-side db operation (/users/update, /users/insert, /users/remove). Because of this, you can’t have two collections with the same name. Your best bet is to give the collections different names. Alternatively, if you don’t need to do client side operations on either of the collections, you can pass defineMutationMethods: false as an option to Mongo.Collection.