geddy / model

Datastore-agnostic ORM in JavaScript
265 stars 55 forks source link

Inconsistency in the Documentation for using postrgres adapter #179

Closed ghost closed 10 years ago

ghost commented 10 years ago

Hello everyone!

I was just using geddy/model for the first time ever and encountered an inconsistency in the documentation. When it comes to the postgres adapter, the connection configurations have to be slightly different than described in the README.

config.dbConfig = { host: 'localhost', username: 'wilson', password: undefined, dbname: 'crosschain_dev'
};

This ends up in doing nothing, not even getting an error callback. So I doug deeper into adapters/sql/postgres.js to console.log myself, getting the following result:

{ [error: database "wilson" does not exist] name: 'error', length: 84, severity: 'FATAL', code: '3D000', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, file: 'postinit.c', line: '775', routine: 'InitPostgres' } { user: 'wilson', database: 'wilson', password: undefined, host: 'localhost', port: 5432, username: 'wilson', dbname: 'crosschain_dev' }

Due to the official Geddy documentation on the Geddy website I came up with this.

config.dbConfig = { host: 'localhost', username: 'wilson', password: undefined, database: 'crosschain_dev'
};

This way it worked perfectly. I will file a pull request with a correction of the README just in time.

I digged a bit deeper and discovered, that the only adapter using the "config.dbname" convention. Is the MongoDB adapter. This might probably a bit misleading and also kind of an inconsistency. So if you are interested in having this one fixed as well, see for my other pull request as there will be just in time.

Best regards, Dennis