Skip to content

"propertyInReference is not defined" error when adding many to one reference property to document  #1827

@hussain18

Description

@hussain18

Describe the bug
When attempting to add a property of type reference to the to a document and choosing the relationship type to many to one, I get the "propertyInReference is not defined" error.

To Reproduce
Here are the steps to produce shown in the screenshot:
Screenshot from 2024-12-11 19-57-53

Expected behavior
Add a property of reference type to the document

Desktop (please complete the following information):

  • OS: Ubuntu 24.04
  • NodeJS: Version v22.11.0
  • Database: MongoDB

Additional context
As I went through the [.hygen/index.js] ( i.e. at line no. 129) file, I noticed that the propertyInReference is only asked from user (i.e in CLI) when one to many relationship is chosen. As a result, the value is undefined but still checked in [.hygen/property/add-to-document/infrastructure/persistence/document/entities/schema.ejs.t] (i.e. line no. 12) when many to one relationship is chosen. So I think, that this could be causing the error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions