question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoDB relations support ?

See original GitHub issue

Issue type:

[x ] question [ ] bug report [ ] feature request [ ] documentation issue

Database system/driver:

[ ] cordova [x ] mongodb [ ] mssql [ ] mysql / mariadb [ ] oracle [ ] postgres [ ] cockroachdb [ ] sqlite [ ] sqljs [ ] react-native [ ] expo

TypeORM version:

[x ] latest [ ] @next [ ] 0.x.x (or put your version here)

Hi there, I’d like to know if typeorm support mongodb relations. If so, how to define this relation in entities.

I want to do a query like this:

 let candidatures = await candidatRepository.find({
            join: {
                alias: "c",
                leftJoinAndSelect: {
                    m: "c.membre"
                }
            },
        });

But json objects returned does not contain “membre” entities.

Membre:

import {Entity, Column, ObjectIdColumn} from "typeorm";
import {ObjectID} from "mongodb";
import {Membre} from "./Membre";

@Entity("candidats")
export class Candidat
{
    @ObjectIdColumn()
    id: ObjectID;
    ...
    //@ObjectIdColumn()
    @Column(type => Membre)
    membre: Membre;
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
theodorDiaconucommented, Feb 3, 2020

@the-nicolas didn’t invest in solving this, I have started creating my own framework.

3reactions
theodorDiaconucommented, Nov 11, 2019

I’m looking to get an integration of this merged: https://www.npmjs.com/package/@kaviar/nova

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model Relationships Between Documents — MongoDB Manual
Presents a data model that uses embedded documents to describe one-to-many relationships between connected data. Model One-to-Many Relationships with Document ...
Read more >
MongoDB - Relationships - Tutorialspoint
Relationships in MongoDB represent how various documents are logically related to each other. Relationships can be modeled via Embedded and Referenced ...
Read more >
Is it possible to have relation between object in a MongoDB ...
MongoDB (and most other NoSQL databases) do not natively support the concept of relations. RDBMSs have native query tools to define and make ......
Read more >
MongoDB Relationships: A Quick Guide - KnowledgeHut
How to best use data relationships in MongoDB? ... With the help of an example, we will now discuss the one-to-many relationship with ......
Read more >
MongoDB Relationships (Embedded & Reference) - DataFlair
One to One Relationship in MongoDB. It is where the parent document has one child, and the child has one parent. With the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found