CB + MongoDB bson structure in model field

48 views
Skip to first unread message

dmit...@gmail.com

unread,
Jan 27, 2014, 1:59:42 PM1/27/14
to chica...@googlegroups.com
Good day to all .

I decide to use mongodb in my project and have some trouble now.
I want to save bson structure in boss module field like :

Structure=[[{a:1},{b:2}],[{a:3},{b:4}]],
some_model:new(id,Structure),

But got problem with list_to_binary function.

Can you help me to solve this. I think to solve this with using some like:

boss_db:transaction(
 some_model:new(id,field),
 mongo:query:insert ... etc.
)
but can't find any examle.

)

Sorry for my English )


Дмитрий Тютерев

unread,
Jan 28, 2014, 12:38:23 PM1/28/14
to chica...@googlegroups.com
For example, i have such data from webform:

Timetables=[[{"date","20.01.2014"},{"in_out","is"},{"type","d"}],[{"dow",[0,"mo","tu","we"]},{"in_out","is"},{"type","dow"}]]
Layers=[[{"id","layer-52e02141421aa9144e000001"},{"in_out","in"}]]
Actions=[[{"value","00"},{"type","sms"}],[{"value","00989"},{"type","sms"}]]

And model :
-module(monitor,[Id, AccountId, KidId, Name, Layers, Timetables, Actions, CreateDate, Status]).

How i can to save Layers if field Layers ?

I try to use bson,bjson,jiffy to encode json, but got errors or binary in field,,,,
but after creating model i want to search some like
db.monitors.find(layers.id=....)

How to do this ?

понедельник, 27 января 2014 г., 22:59:42 UTC+4 пользователь Дмитрий Тютерев написал:
Reply all
Reply to author
Forward
0 new messages