[erlang-questions] Why is this delete_object giving me an error?

ryeguy <>
Mon Mar 16 14:05:25 CET 2009


I don't see what's wrong here, but I may just misunderstand the
syntax. I'm trying to delete a "user" record from my "user" mnesia
table who have the first name of "ryan" (there are multiples of them).
Here is what I do:

Delete=#user{first_name = "ryan", _ = '_'},
mnesia:dirty_delete_object(Delete)

Here is my record definition:
-record(user, {id,
			   username,
			   password,
			   email,
			   first_name,
			   last_name,
			   last_login, % Date/time user last logged in
			   reg_date}). % Date/time user registered the account

And here is the exception I'm getting:
** exception exit: {aborted,
                       {bad_type,user,
                           {user,'_','_','_','_',"ryan",'_','_','_'}}}
     in function  mnesia:abort/1
     in call from users:register/1

It seems like a perfect match. What could cause this problem?




More information about the erlang-questions mailing list