I'm trying to use the loopback 4, but when I run this query:
const AccountA = new AccountRepository(new BANCbDataSource())
const bb = await AccountA.find({where: {title: '34'}});
I receive this error:
TypeError: Cannot read property 'all' of undefined
Inside /node_modules/loopback-datasource-juggler/lib/dao.js:1797:27)
I really dont know what is happening ...
My datasource:
import {inject, lifeCycleObserver, LifeCycleObserver} from '@loopback/core';
import {juggler} from '@loopback/repository';
const config = {
name: "bancdv",
user:" ",
password: "",
host:"",
port: 1234,
database: ""
}
@lifeCycleObserver('datasource')
export class BANCbDataSource extends juggler.DataSource
implements LifeCycleObserver {
static dataSourceName = 'bancdv';
static readonly defaultConfig = config;
constructor(
@inject('datasources.config.bancdv', {optional: true})
dsConfig: object = config,
) {
super(dsConfig);
}
}
Can someone help me? I already spent 3 days trying a lot of things, but nothing worked..
I expect to get data from database