Coder Social home page Coder Social logo

Comments (5)

joannechan avatar joannechan commented on July 25, 2024 1

@cognitom Have this support for json datatype would be hugely beneficials. Is this something that's going to be supported in the near future? I am comparing this with mosql which only support postgres.

from momy.

cognitom avatar cognitom commented on July 25, 2024

Hi @joannechan, momy supports only these types described in README.

We may have two options, I think.

  1. make momy more customizable: custom converter or something
  2. add JSON data type support

The latter one would be easier to implement, but analyzing JSON type may have some difficulty.

Note: MySQL has no array data type, but in v5.7 they introduced the new type for JSON.

from momy.

cognitom avatar cognitom commented on July 25, 2024

To achieve the first option, we may need to allow JavaScript style configuration (momyfile.js), instead of momyfile.json.

// momyfile.js could be like this...?

const config = {
  "src": "mongodb://localhost:27017/dbname",
  "dist": "mysql://root:password@localhost:3306/dbname",
  "prefix": "t_",
  "case": "camel",
  "collections": {
    "collection1": {
      "_id": "number",
      "field1": "string",

      // This doesn't work at this point,
      // but this type of conversion could be useful in some cases.
      "field2": {
        "type": "string",
        "convert": val => Array.isArray(val) ? val.join('\t') : val
      }
    }
  }
}

export default config

from momy.

Xsmael avatar Xsmael commented on July 25, 2024

i strongly agree with @joannechan supporting arrays would be so much useful especially when it comes to mongoDB, its hard to find a database without arrays. But is it possible to treat the array as a collection and documents inside would be the collection documents ? since they also have an _id field

from momy.

game5413 avatar game5413 commented on July 25, 2024

Maybe my contribute progress #31 fit with your requirements, i had already implement feature that if some column have data type like array on json, it will be maping to new table and adding parent ID to that row, just add some relations object key on momyfile.json to make it read the mapping.

cc @joannechan , @Xsmael (sorry for directly mention, just want to be helpful)

PS: Sorry, if my english language so bad.

from momy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.