Error parsing Boss record id: error:{badmatch,["dV52EVzNs27iOP"]}

41 views
Skip to first unread message

Mert Öztürk

unread,
Apr 27, 2015, 5:53:19 PM4/27/15
to chica...@googlegroups.com
Hello,

This happens when i want to save a record to mongodb. A new record is created but doesnt save the value after id which is automatically generated by mongodb and shows it as [].
Also i get the error : Error parsing Boss record id: error:{badmatch,["dV52EVzNs27iOP"]}
Did this happen to anyone before?

Thanks Mert

Dmitry Polyanovsky

unread,
Apr 28, 2015, 5:27:48 AM4/28/15
to chica...@googlegroups.com
As I may recall, id should be an number or uuid if you set it with id::uuid() in your model

--
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/d0260a36-cb9f-4796-ac02-59e8a9c99eff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Graeme Defty

unread,
Apr 28, 2015, 5:53:27 AM4/28/15
to chica...@googlegroups.com

The best thing to do when creating a new record is to set the id to the atom 'id' and let CB allocate a key for the record.



Dmitry Polyanovsky

unread,
Apr 28, 2015, 6:00:22 AM4/28/15
to chica...@googlegroups.com

Graeme Defty

unread,
Apr 28, 2015, 6:02:18 AM4/28/15
to chica...@googlegroups.com
OOps!  Sorry - I think I misunderstood your problem.

Can you please show us the contents of you NewQdata record which you are trying to save.

g



Mert Öztürk

unread,
Apr 28, 2015, 10:32:30 AM4/28/15
to chica...@googlegroups.com
Hello,

I changed my model from

-module(question_data, [Id,QData1,QData2,QData3,QData4,QData5,QData6]).
-compile(export_all).

 to the below;

-module(question_data, [Id::uuid(),QData1,QData2,QData3,QData4,QData5,QData6]).
-compile(export_all).

Then i tried again to save a record to mongodb as below;

NewQData = question_data:new(id,Data1,Data2,Data3,Data4,Data5,Data6),
{ok,SavedQData} = NewQData:save(),

Every Data (Data1,Data2,Data3,Data4,Data5,Data6) i am trying to save are strings. I face with the same error again:  Error parsing Boss record id: error:{badmatch,["Y39OPvJ1PrVf4"]}
And Data1 is saved to mongodb database as []. Whatever i put after id gets the same error and saved to mongo database as [].

Thanks
Mert




28 Nisan 2015 Salı 13:00:22 UTC+3 tarihinde Dmitry Polyanovsky yazdı:

Mert Öztürk

unread,
Apr 28, 2015, 10:49:32 AM4/28/15
to chica...@googlegroups.com
And also i have to mention that this is my second mongodb database on one application. 
First one is working fine without any errors although i do the same process for saving as i mentioned on my previous message.
I used the first one with [Id,Data1,Data2,Data3,Data4,Data5] and working without any problem.
I am using to Data1,2,3,4,5 as example to show. They are all strings.

Thanks
Mert


28 Nisan 2015 Salı 13:00:22 UTC+3 tarihinde Dmitry Polyanovsky yazdı:

Kai Janson

unread,
Apr 28, 2015, 11:34:36 AM4/28/15
to chica...@googlegroups.com
Hi,

Simply put: you can't do that.
MongoDB has its own _id format.

BossDB splits the table name off the id after the first "-" it finds; UUIDS have several "-".

Use it with id and the world is good again.

--Kai

Sent from my iPhone
--
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.

Mert Öztürk

unread,
Apr 28, 2015, 4:46:07 PM4/28/15
to chica...@googlegroups.com
Hello Kai,

I will use mock again instead of mongo as the third database.

Thanks for support
Mert

28 Nisan 2015 Salı 18:34:36 UTC+3 tarihinde Kai Janson yazdı:
Reply all
Reply to author
Forward
0 new messages