EnterpriseDB / mongo_fdw

PostgreSQL foreign data wrapper for MongoDB
GNU Lesser General Public License v3.0
330 stars 70 forks source link

0 rows in foreign table #125

Open nisanth456 opened 5 years ago

nisanth456 commented 5 years ago

0 rows in foreign table when i using select

oksuz commented 4 years ago

Hi, check mongo access logs if you see logs like following

2020-01-21T18:46:25.660+0000 I  ACCESS   [conn1156] Unauthorized: not authorized on GT100 to execute command { count: "login", $db: "GT100", $readPreference: { mode: "primaryPreferred" }, lsid: { id: UUID("e6f38c72-1cbc-470d-93fb-292320cf8344") } }
2020-01-21T18:46:25.721+0000 I  ACCESS   [conn1156] Unauthorized: not authorized on GT100 to execute command { count: "login", $db: "GT100", $readPreference: { mode: "primaryPreferred" }, lsid: { id: UUID("e6f38c72-1cbc-470d-93fb-292320cf8344") } }
2020-01-21T18:46:25.784+0000 I  ACCESS   [conn1156] Unauthorized: not authorized on GT100 to execute command { find: "login", filter: {}, $db: "GT100", $readPreference: { mode: "primaryPreferred" }, lsid: { id: UUID("e6f38c72-1cbc-470d-93fb-292320cf8344") } }

you probably have authentication problem.

Create user on your mongo db before creating foreign server like this:

db.createUser({ user: 'username', pwd: 'password', roles: ['readWrite'] });

while creating your foreign db use authentication_database option which db you've user created on it.

vaibhavdalvi93 commented 2 years ago

@nisanth456 , Are you still facing an issue? If not, can you please close this ticket?