How to duplicate boss_record with new id ?

32 views
Skip to first unread message

amit....@alphonso.in

unread,
May 13, 2014, 7:52:37 AM5/13/14
to chica...@googlegroups.com, ameet...@gmail.com


Hello there,

I have the model:
  -module(person, [Id, Name, DateOfBirth]). 

If I have id of one person

PersonRec = boss_db:find(Id)

then I want to copy PersonRec with new unique id and save it to the database.

I am using mongodb.

Is there any in-built function in chicago boss ?

Thanks in advance.  

Jesse Gumm

unread,
May 13, 2014, 9:41:36 PM5/13/14
to chica...@googlegroups.com, ameet...@gmail.com
Hi Amit,

You can copy the record and make a new one byc

PersonRec = boss_db:find(Id),
NewPerson = PersonRec:set(id, id),
NewPerson:save().

Hope that helps,

-Jesse
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to chicagoboss...@googlegroups.com.
> Visit this group at http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/chicagoboss/5d04d410-e41e-483e-972b-b07165f2e7a7%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm

can2nac

unread,
May 14, 2014, 10:13:52 AM5/14/14
to chica...@googlegroups.com, ameet...@gmail.com
{ok,P} = ((boss_db:find(Id)):set(id,id)):save().
Reply all
Reply to author
Forward
0 new messages