- Is it right to keep the metadata in MongoDB and the actual file in a third party storage (S3 and feel free to make recommendations here)?
/Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/datasource.js:473
modelClass[r.type].call(modelClass, rn, params);
^
TypeError: Cannot call method 'call' of undefined
at /Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/datasource.js:473:28
at Array.forEach (native)
at DataSource.defineRelations (/Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/datasource.js:433:28)
at DataSource.setupDataAccess (/Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/datasource.js:515:8)
at DataSource.attach (/Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/datasource.js:734:8)
at Function.ModelClass.attachTo (/Users/strongloop-api/node_modules/loopback-datasource-juggler/lib/model-builder.js:290:16)
at Object.registry.configureModel (/Users/strongloop-api/node_modules/loopback/lib/registry.js:174:15)
at configureModel (/Users/strongloop-api/node_modules/loopback/lib/application.js:396:12)
at EventEmitter.app.model (/Users/strongloop-api/node_modules/loopback/lib/application.js:130:5)
at /Users/strongloop-api/node_modules/loopback-boot/lib/executor.js:144:9
{
"name": "File",
"plural": "containers",
"properties": {},
"validations": [],
"relations": {
"metadata": {
"type": "belongsTo",
"model": "FileMetadata"
}
},
"acls": [],
"methods": []
}
{
"name": "FileMetadata",
"base": "PersistedModel",
"plural": "files-metadata",
"properties": {
"name": {
"type": "string",
"required": true
}
},
"validations": [],
"relations": {
"contents": {
"type": "hasOne",
"model": "File"
},
"container": {
"type": "belongsTo",
"model": "FileContainer",
"foreignKey": "fileContainerId"
}
},
"acls": [],
"methods": []
}
@Raymond @Miroslav, this is related to a question somebody else asked:Since we can't directly create relations between the File/Container model and the other DB based model in our application, as I said, one way to do it would be to use remote/model hooks to simulate it. I think the most efficient way to do it would be to retrieve the currently logged in user from the request after authentication but I don't see a straightforward way of doing that. Any pointers there?