1602 / jugglingdb

Multi-database ORM for nodejs: redis, mongodb, mysql, sqlite3, postgresql, arango, in-memory...
http://1602.github.io/jugglingdb/
2.04k stars 241 forks source link

Use tableName as adapter collection name #337

Closed kapouer closed 10 years ago

kapouer commented 10 years ago

It appears it's relatively easy to use settings.table without having to rewrite all adapters. It's working all right in my app - for now -

kapouer commented 10 years ago
kapouer commented 10 years ago

thanks !

kapouer commented 10 years ago

When given a modelName, the SQL adapters already have correct tableName translation in BaseSQL.prototype.table, unfortunately, that approach is not used in mongo adapter. So my fix is wrong - i should have fixed the mongo (and possibly others) adapter to use a similar approach, i.e. use models[modelName].tableName everywhere it is needed. I'll submit pull requests today to fix this.