momy icon indicating copy to clipboard operation
momy copied to clipboard

dynamic addition of collections to sync

Open miraculixx opened this issue 5 years ago • 1 comments

What would be the best way to add a dynamic sync, i.e.

  1. automatically detect new, unsynced collections in mongo db
  2. add all fields of a collection without having to specify in momyfile.json
  3. re-read momyfile.json regularly, possibly from a remote location (http), with auto --import on detecting new collections

With at least 3. implemented 1. & 2. would basically come for free, as one could write some application/mongodb-side script to publish a new momyfile when needed, without having to restart momy.

miraculixx avatar Jul 11 '19 23:07 miraculixx

Hi @miraculixx, an interesting question, eventhough I have no good answer about it now...

I think, typically, your 1. & 2. are not easy for automation because there's no perfect way to convert the data from NoSQL to SQL. How about separating the problem and focus to these steps below at first?:

  1. add some field definitions to momyfile manually
  2. detect momyfile changes and add some column to MySQL DB (not implemented)
  3. add some new fields to a document in the Mongo DB collection, then momy will detect the changes

At this point, we need to drop and recreate a table in MySQL, but it would cost too much. It seems that we need some implementation to handle the diff of momyfile.

cognitom avatar Jul 12 '19 03:07 cognitom