How to use other Model in data source?
See original GitHub issueI tried to use mongoose
// Model
const Model1 = mongoose.model('col1', Schema1)
const Model2 = mongoose.model('col2', Schema2)
// Data source
export default class Data1 extends MongoDataSource {
getData1(name) {
// How to use `Model2`
return this.model.findOne({ name: name })
}
}
........................
// Apollo server
...........
dataSources: () => ({
data1: new Data1(Model1),
data2: new Data2(Model2),
}),
How to use Model2
in DataSource1 (Data1)?
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How should I model a single entity that has data from multiple ...
Your database has a minimum of three tables, and really should have many more: The first is for the car type, which really...
Read more >Using Multiple Data Sources in Your Model - IBM
You can create more powerful views of your data by adding multiple data sources to a single model, allowing you to combine disparate...
Read more >Relationships between tables in a Data Model
A relationship is a connection between two tables of data, based on one column in each. A workbook can store each piece of...
Read more >Data Modeling with Multiple Data Source Types - InetSoft
Launch the Data Modeler from the Windows 'Start' menu: Start → All Programs → Style Intelligence → Data Modeler. · Click the 'New...
Read more >How To: Import & merge Data Models / Data Sources / Views ...
You can use this technique to merge as many data models as you like, even the same target database type (e.g. multiple instances...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Very thanks again 👍
You might be able to use context inside the getData method in the Data1 class.