Delete belongsTo relationship

Expected behavior

When viewing list of records in a belongs to relationship, selecting a record and then delete leads to a refresh, but no delete end point is ever called.

Actual behavior

Does not call any endpoint

Failure Logs

Please include any relevant log snippets, if necessary.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect:
  • Database Version:
  • Project Name:

Hi @Liam_Cheung !

Can you fill out the context part of your post ?
Can you share the models linked to the collections that have the belongsTo relationship ?

@Liam_Cheung Looking at your screenshot it looks like a hasMany relationship.

Here Audit test hasMany Documents

When deleting a document from an Audit test, no route/end point is ever called.

Is that right?

Hi,

Yes that is correct.

Liam

Hello @Liam_Cheung :wave:

I couldnā€™t reproduce this with a hasMany relationship. Do you have any errors in your console ?

Steve.

Nothing in the console that I can seeā€¦

Note that this only happens when accessing the record through a relationship, it does work when accessing the collection directly.

Liam

Hey @Liam_Cheung,

Could you send a video reproducing this issue with your network tabs open please :pray:. You can use Loom for example.

Hi, I uploaded a quicktime to my google drive. I am hoping you can ask for permission to view and I can grant it.
https://drive.google.com/file/d/1HqySxBlRan23nJMXNFvckYfg6m_it09H/view?usp=sharing

Hi @Liam_Cheung,
I am sorry but the video quality is so low that I cannot read the error messages.
Would you mind doing this record with something like Loom?
Thanks!

1 Like

I just shared with you the high quality version of the file.

Hi @Liam_Cheung,

Are your ā€œDocumentsā€ linked to ā€œAudit Testā€ via a smart relationship ? Iā€™ll test in that specific case but I think this might be related to the original issue

In collection(ā€˜usersā€™, ā€¦fields: [ā€¦
{
field: ā€˜documentsā€™,
type: [ā€˜Stringā€™],
reference: ā€˜document._idā€™,
}
], ā€¦)

Great. And I guess your Documents is similar to the one from our Smart collections example ?

Iā€™m currently giving this setup a try, just to make sure Iā€™m able to reproduce

Actaully I see what you mean now. Both users and documents are regular mongo collections.

Hi @Liam_Cheung,

Could you tell me how your Documents are related to the Users collection? Is that a subcollection (ie. documents are stored directly on users and displayed as a relationship)? Or a reference (ie. any document carry a reference to a user)?

Thanks in advance, that might be of some help to reproduce your issue.

As a reference. The document has a field user_id so the relationship lists all documents with that user id.

Hey @Liam_Cheung Iā€™ve added a ticket on our end to tackle this issue asap. Iā€™ll let you know once we have something on our end.

1 Like

@Liam_Cheung Weā€™ve released a fix! We now trigger HTTP DELETE for hasMany smart relationship. Let us know if that helps!

2 Likes

Hi @louis

Thanks for this. I notice that the url comes in as:
Request URL:https://forest-map.qa.eu.mylo.ai/forest/users/5f18847ea674170007ede6ef/relationships/documents?delete=true

Request Method: DELETE

Does the parameter delete=true at the end mean anything?

Also the payload seems a little differnt than normal, when we ask to delete multiple records in a regular collection we get this payload:
image

Which is parsable with RecordsGetter.getIdsFromRequest

With this one will there be a parser to get the ids?
image

Liam