Hi,<br><br>dirty_delete_object (and also delete_object) can only be used with a complete record - i.e. all fields must be filled in. It does not accept wildcard patterns.<br><br>If you want to delete all user with a certain first name, you need an index on the first_name attribute, query for all users with that first name using mnesia:index_read or dirty_index_read, and finally manually delete all returned records with delete_object or delete.<br>
<br>Regards,<br><br>Jeroen<br><br><div class="gmail_quote">On Mon, Mar 16, 2009 at 2:05 PM, ryeguy <span dir="ltr"><<a href="mailto:ryeguy1@gmail.com">ryeguy1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I don't see what's wrong here, but I may just misunderstand the<br>
syntax. I'm trying to delete a "user" record from my "user" mnesia<br>
table who have the first name of "ryan" (there are multiples of them).<br>
Here is what I do:<br>
<br>
Delete=#user{first_name = "ryan", _ = '_'},<br>
mnesia:dirty_delete_object(Delete)<br>
<br>
Here is my record definition:<br>
-record(user, {id,<br>
                           username,<br>
                           password,<br>
                           email,<br>
                           first_name,<br>
                           last_name,<br>
                           last_login, % Date/time user last logged in<br>
                           reg_date}). % Date/time user registered the account<br>
<br>
And here is the exception I'm getting:<br>
** exception exit: {aborted,<br>
                       {bad_type,user,<br>
                           {user,'_','_','_','_',"ryan",'_','_','_'}}}<br>
     in function  mnesia:abort/1<br>
     in call from users:register/1<br>
<br>
It seems like a perfect match. What could cause this problem?<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br>