How to ignore values when using mnesia?

I can’t seem to find the answer for this after hours of Googling.

    :mnesia.transaction(fn ->
      :mnesia.delete_object({User, :_, phone, :_})      

I am trying to delete a particular record using the phone number while ignoring other fields. I can’t seem to find any information on how to ignore fields for this action. I tried :_ as suggested by some but received the following error.

{:aborted, {:bad_type, Database.User, {Database.User, :_, 12345, :_}}}

I can execute this if I provide values for all fields. Can any of you shed some light on this? Thank you!!

If a table is of type bag, it can sometimes be needed to delete only some of the records with a certain key. This can be done with the function delete_object/3. A complete record must be supplied to this function.

AS the docs say you need to provide a complete record, therefore you need to first find the record and then pass it to the delete function.

Maybe just delete/3 will do what you want:

Deletes all records in table Tab with the key Key.

I always find a record with a key or value concerned and after that delete or edit the record, I found

Thank you. I chose to retrieve followed by deleting the record in the end as I have no choice. Would have been great to do it in one go…