extract-mongo-schema icon indicating copy to clipboard operation
extract-mongo-schema copied to clipboard

Foreign keys detection

Open danmo opened this issue 7 years ago • 3 comments

How are foreign keys detected/ reverse-engineered?

Tried to generate the html representation but no inter-collection relation was detected. So I have a list of isolated tables atm.

danmo avatar Jun 12 '18 12:06 danmo

@danmo foreign key is detected with regex, if format is equal to usual mongoId then collections are scanned for this value. Not the best approach I know but worked for me for particular use case.

Any suggestions?

perak avatar Jun 12 '18 13:06 perak

What about allowing to set some schema files as parameter to give more guidance instead of just only search for objects?

piranna avatar Jan 18 '19 10:01 piranna

@perak I think https://github.com/perak/extract-mongo-schema/blob/master/extract-mongo-schema.js#L80 limits detection to just mongo ObjectId's now and not to things like Strings

RobertLowe avatar Jul 14 '20 02:07 RobertLowe