Search code examples
mongodbchicagoboss

Chicago Boss Saving Bson Object into mongoDB


I am trying to add an bson object to a field in my mongodb data base using bc

Model

 -module(clientList, [Id, Listname, Email, Datablock]).
 -compile(export_all).

Code

ClientList = clientList:new(id, "Bill","bill@email.com",{{"0","Field1"},{"1","Field2"},{"2","Field3"}})
boss_db:transaction ( fun()-> ClientList:save() end).

Error

[error] Error in controller error undef

I understand that a bossRecord is not the same as a bson object, but I am unsure how to get it in there, is there a converter, do I need to create a new boss record.

Also if anyone know any site that explains anything to do with Chicago boss database access could you let me know, I am finding that the documentation for it is useless or I am not getting it


Solution

  • You should put your BSON fields in a list:

    ClientList = clientList:new(id, "Bill","bill@email.com",[{"0","Field1"},{"1","Field2"},{"2","Field3"}]).