Re: [chicagoboss] Storing MongoDB with Objects

2014-08-22 Thread can2nac
works like magic

%clients.erl
-module(clients, [Id, Listname, Email, Datablock]).
-compile(export_all).

(rahm@can2nac-laptop)14> 
(clients:new(id,"Bill","t...@test.com",[{'1',<<"Field1">>},{two,"two"},{three,3}])):save().
 
   
{ok,{clients,"clients-53f75484b3769c0ec20b","Bill",
 "t...@test.com",
 [{'1',<<"Field1">>},{two,"two"},{three,3}]}}
(rahm@can2nac-laptop)15> boss_db:find("clients-53f75484b3769c0ec20b").
{clients,"clients-53f75484b3769c0ec20b",<<"Bill">>,
 <<"t...@test.com">>,
 [{'1',<<"Field1">>},{two,"two"},{three,3}]}

more here http://www.erlang.org/doc/man/proplists.html

pay attention to Keys

On Friday, August 22, 2014 6:11:23 PM UTC+4, graeme defty wrote:
>
> Jason,
>
> This may not be your problem, but . . . bear in mind that boss_db does not 
> support the storage of arbitrary erlang terms in a boss db field - check 
> the documentation here http://www.chicagoboss.org/api-record.html to see 
> what is supported. (It may be that your bson falls under the category of 
> 'binary' in which case you should not have an issue), Now, although that is 
> the OFFICIAL (i.e. documented) position, CB does not do anything to prevent 
> it, so it depends on the adaptor for the particular db you are using. The 
> Mnesia adaptor does, but that is because Mnesia runs in erlang. It is quite 
> possible that the Mongo adaptor does not support this behaviour.
>
> I should point out that my experience is all with Mnesia. Perhaps someone 
> who knows Mongo better than I can help you with your real problem. LoL
>
> graeme
>
>
>
>
>
>
> On 19 August 2014 06:30, jason stewart > 
> wrote:
>
>> I am trying to add an bson object to a field in my mongodb database using 
>> bossRecord 
>>
>> Model
>>
>>  -module(clientList, [Id, Listname, Email, Datablock]).
>>  -compile(export_all).
>>
>> Code
>>
>> ClientList = clientList:new(id, "Bill","bi...@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 its just  I am not getting it 
>>
>>  -- 
>> 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/7c6c4513-aebd-4c1b-bf9f-7747220f7187%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@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/aad0fe33-061f-47e7-8785-61ee9779059a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [chicagoboss] Storing MongoDB with Objects

2014-08-22 Thread Graeme Defty
Jason,

This may not be your problem, but . . . bear in mind that boss_db does not
support the storage of arbitrary erlang terms in a boss db field - check
the documentation here http://www.chicagoboss.org/api-record.html to see
what is supported. (It may be that your bson falls under the category of
'binary' in which case you should not have an issue), Now, although that is
the OFFICIAL (i.e. documented) position, CB does not do anything to prevent
it, so it depends on the adaptor for the particular db you are using. The
Mnesia adaptor does, but that is because Mnesia runs in erlang. It is quite
possible that the Mongo adaptor does not support this behaviour.

I should point out that my experience is all with Mnesia. Perhaps someone
who knows Mongo better than I can help you with your real problem. LoL

graeme






On 19 August 2014 06:30, jason stewart  wrote:

> I am trying to add an bson object to a field in my mongodb database using
> bossRecord
>
> Model
>
>  -module(clientList, [Id, Listname, Email, Datablock]).
>  -compile(export_all).
>
> Code
>
> ClientList = clientList:new(id, "Bill","b...@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 its just  I am not getting it
>
>  --
> 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+unsubscr...@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/7c6c4513-aebd-4c1b-bf9f-7747220f7187%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@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/CAKF5fiAX0oDw65ZcxvU2KvFPYpsDR19QoEM3mONNBK1ofxD%2Bmg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [chicagoboss] Storing MongoDB with Objects

2014-08-18 Thread jason stewart
Hi Kia, 

I changed the save 

ClientList:save().

Now I get an error that looks like this 

[error] gen_server <0.285.0> terminated with reason: no function clause 
matching bson_binary:put_field_accum("Field1", "Name", <<>>) line 93


On Tuesday, 19 August 2014 12:43:01 UTC+10, Kai Janson wrote:
>
> Hi Jason,
>
> Try your saving without the transaction.
>
> --Kai 
>
> Sent from my non-google-device
>
> On Aug 18, 2014, at 18:30, jason stewart > 
> wrote:
>
> I am trying to add an bson object to a field in my mongodb database using 
> bossRecord 
>
> Model
>
>  -module(clientList, [Id, Listname, Email, Datablock]).
>  -compile(export_all).
>
> Code
>
> ClientList = clientList:new(id, "Bill","bi...@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 its just  I am not getting it 
>
>  -- 
> 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/7c6c4513-aebd-4c1b-bf9f-7747220f7187%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
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+unsubscr...@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/b5a962dd-1cdc-4f2b-8c2b-ff38c0576388%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [chicagoboss] Storing MongoDB with Objects

2014-08-18 Thread Kai Janson
Hi Jason,

Try your saving without the transaction.

--Kai 

Sent from my non-google-device

> On Aug 18, 2014, at 18:30, jason stewart  wrote:
> 
> I am trying to add an bson object to a field in my mongodb database using 
> bossRecord 
> 
> Model
> 
>  -module(clientList, [Id, Listname, Email, Datablock]).
>  -compile(export_all).
> 
> Code
> 
> ClientList = clientList:new(id, 
> "Bill","b...@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 its just  I am not getting it 
> 
> -- 
> 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+unsubscr...@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/7c6c4513-aebd-4c1b-bf9f-7747220f7187%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@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/68717AC6-5E21-4AE8-BB10-9F67FCA5C93B%40gmail.com.
For more options, visit https://groups.google.com/d/optout.