当前位置: 动力学知识库 > 问答 > 编程问答 >

access Mongo replicaset through meteor using username and password

问题描述:

I am using mongo replicaset through my meteor app.

Here is my connection string and code:

var collectionsDB = new MongoInternals.RemoteCollectionDriver("mongodb://usr:[email protected]:27017,user:[email protected]:27017,use:[email protected]:27017/myDB?replicaSet=myRelicaset&authSource=myDB&readPreference=primaryPreferred&w=1");

coll = new Mongo.Collection('<myCollection>',{ _driver:collectionsDB });

Problem:

When I am trying to insert to mongoDB, it tries to insert into Admin db rather myDB. The user usr has readwrite permission for myDB. I fail to understand why it is targeting Admin. As it does not have permission in Admin it through permission error.

However it works fine for individual mongo server without replicaset.

Any thing I am missing in connection string?

thanks

Nihar

分享给朋友:
您可能感兴趣的文章:
随机阅读: