1
votes

I am getting [object Promise] error whenever I try to add a relation between 2 models. Please see the below snippet.

C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server>slc loopback:model ? Enter the model name: Test2 ? Select the data-source to attach undefined to: MongoDB (mongodb) ? Select model's base class PersistedModel ? Expose Test2 via the REST API? Yes ? Custom plural form (used to build REST URL): ? Common model or server only? common Let's add some Test2 properties now.

Enter an empty property name when done. ? Property name: Price invoke loopback:property ? Property type: string ? Required? Yes ? Default value[leave blank for none]:

Let's add another Test2 property. Enter an empty property name when done. ? Property name: Label invoke loopback:property ? Property type: string ? Required? Yes ? Default value[leave blank for none]:

Let's add another Test2 property. Enter an empty property name when done. ? Property name:

C:\sairam\OMSaiRamC\FullStack\Session - 5\Week 4\loopback-server>slc loopback:relation ? Select the model to create the relationship from: Test1 ? Relation type: has many ? Choose a model to create a relationship with: Test2 ? Enter the property name for the relation: (test2s)

[object Promise]

2

2 Answers

0
votes

The issue is resolved. Strongloop acknowledged this as a bug in their latest version of generator-loopback npm module. So the issue is resoled.

0
votes

Reinstall Loopback and solve that problem

sudo npm install -g strongloop