Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for "db types" #115

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add support for "db types" #115

wants to merge 4 commits into from

Conversation

Pierrci
Copy link
Member

@Pierrci Pierrci commented May 21, 2024

This PR adds the ability to retrieve the "types" associated with the collections of a db from a remote service (one URL per server), allowing to link between documents from different collections.

See

Mongoku/lib/Database.ts

Lines 17 to 32 in 25492ac

export type Reference = {
/** The external collection this references links to */
collection: string;
/** The key in the external collection, useful to generate a query based on it */
key: string;
}
/**
* List of keys in the collection documents that are associated with documents in other collections
* The collection a key refers to can vary from one document to another, hence the array
*/
export type CollectionRefs = { [prop: string]: Reference[]; }
export type DbRefs = {
[collection: string]: CollectionRefs;
}

@@ -9,6 +9,8 @@
</button>
<div *ngIf="adding">
<input type="text" placeholder="user:password@hostname:port" [(ngModel)]="newServer" [disabled]="loading" />
<input type="text" placeholder="URL to retrieve server types" [(ngModel)]="newTypesUrl"
[disabled]="loading" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this could be controlled by an env var?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not mandatory, but yes why not

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(im wondering if some other people are using Mongoku in prod btw)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be some "experimental" feature flag maybe

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm not sure it's worth the hassle for one feature, this is old technology we're working with here - no simple way to pass the value of a server-side env var to the front

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

Successfully merging this pull request may close these issues.

3 participants