Skip to content
This repository has been archived by the owner on Mar 1, 2022. It is now read-only.

Design config options for mongo-knex #4

Closed
5 tasks done
kirrg001 opened this issue Nov 7, 2018 · 2 comments · Fixed by #30
Closed
5 tasks done

Design config options for mongo-knex #4

kirrg001 opened this issue Nov 7, 2018 · 2 comments · Fixed by #30
Assignees
Labels

Comments

@kirrg001
Copy link
Contributor

kirrg001 commented Nov 7, 2018

Problem

Projects want to use NQL and want to forward information about database tables, in particular database relations.

Goal

Design a config options which makes it possible to query the database based on this config object.
How do we pass the table information to mongo-knex?

Tasks

@kirrg001 kirrg001 added the design label Nov 7, 2018
This was referenced Nov 8, 2018
@kirrg001
Copy link
Contributor Author

kirrg001 commented Dec 5, 2018

NOTE: Expansions (previous aliases) are not forwarded to mongo-knex. Aliases are handled in nql-lang (see). They are handled in mongo-utils.


The design we need here is for passing the relations.

We currently use:

    relations: {
        [name-of-relation]: {
            tableName: String (e.g. tags)
            tableNameAs: String (e.g. t, optional)
            type: String (e.g. manyToMany)
            join_table: String (e.g.  posts_tags)
            join_from: String (e.g. post_id)
            join_to: String (e.g. tag_id)
        }

We should think about if this structure also works for other relation types.
We should think about if we like the variable names.

kirrg001 added a commit that referenced this issue Dec 5, 2018
refs #4

- mongo-knex does not know about the aliases/expansions concept
- mongo-knex receives a full and ready mongo JSON object
- mongo-knex task is it to apply queries to a query builder
- mongo-knex task is not to replace values
@naz
Copy link
Contributor

naz commented Dec 7, 2018

The naming of variables should def be more consistent e.g.: tableNameAs an join_table. Preferable should stay camelCase as these are only used within JavaScript code :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants