dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

Support for external associations #613

Open gileze33 opened 9 years ago

gileze33 commented 9 years ago

This is probably outside of the scope of this project, but I thought it was worth noting as it's something we've been discussing internally in our team.

As any project scales, sometimes it becomes more efficient to store different types of data in different types of data stores. As a basic example, we currently use MySQL for time-range based appointment data, but are gradually migrating to Neo4J and elasticsearch for a lot of the more flexible data, e.g. user profiles

Our current roadmap requires a significant refactor of anywhere that references appointment.user (as it used to be defined using hasMany / hasOne and pulled in via an autoFetch). After a bit of thought, I was wondering what the scope of being able to define an 'adapter' to allow for a particular association to call another library asyncrounously and callback with an object or null, much as orm2 does with it's current association model.

Just wanted to put out a feeler to see if it's something that might interest anybody else - if not we might go for the custom route - if it does then we'd be interested in co-authoring a plugin or similar for others to use.