How to store Model Definitions into MongoDB as Loopback Model

37 views
Skip to first unread message

VC

unread,
Dec 6, 2016, 12:06:55 PM12/6/16
to LoopbackJS
Hi, I'm new to Loopback.

I am wondering how I can be best store Model definitions (that I want to generate dynamically) into a MongoDB collection as a Loopback Model.
Is there an existing Model definition for the Model definitions within the system perhaps that I could use as a schema for my MongoDB?

Thanks in advance,
-- VC

sim...@ca.ibm.com

unread,
Dec 8, 2016, 1:28:41 PM12/8/16
to LoopbackJS

VC

unread,
Dec 8, 2016, 4:05:20 PM12/8/16
to loopb...@googlegroups.com
Yes, but that's not quite what I was thinking of.

For instance, using the example on the page that you linked to, I want to be able to call: db.getModelDefinition("User")
and store the output object into a MongoDB collection with a schema for any valid Model Definition.
However, if I used the buildModelFromInstance method, it won't be a complete representation of all the ways the ModelDefinition can be defined. 
I guess I am wondering if there is a schema (or Model Definition) that represents any other Model Definition (including itself) within the system.


Thanks.
Reply all
Reply to author
Forward
0 new messages