[1542] invalid argument type used in call to function 'LIKE()'

73 views
Skip to first unread message

Carlos Kelkboom

unread,
Mar 19, 2014, 8:12:31 AM3/19/14
to aran...@googlegroups.com
Hi,
I have a small question about an AQL query which I've written. I've started dabbling in AQL two days ago and can't seem to get even the simplest queries to work.
The query is the following:

FOR m IN setting  FILTER LIKE(m.statistics, '%INT%', true) && m.entity == 'skill'  RETURN m

The result is:

[1542] invalid argument type used in call to function 'LIKE()'

The collection I'm querying is called setting. I have all kinds of documents in this collection with all kinds of structures, the property I'm querying is not a part of every document.

Thank you in advance for your time. I hope we can solve this,
Cheers, Carlos

Jan Steemann

unread,
Mar 19, 2014, 8:25:19 AM3/19/14
to aran...@googlegroups.com
Hi Carlos,

if "m.statistics" is an optional attribute for the documents in the
collection, the query will fail when invoking function LIKE() on it.

LIKE() wants a string as its first argument.

You might change the query to something like this:

FOR m IN setting
FILTER IS_STRING(m.statistics) &&
LIKE(m.statistics, '%INT%', true) &&
m.entity == 'skill'
RETURN m

This will skip over all documents in which m.statistics is not a string.

Best regards
Jan
> --
> You received this message because you are subscribed to the Google
> Groups "ArangoDB" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to arangodb+u...@googlegroups.com
> <mailto:arangodb+u...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Carlos Kelkboom

unread,
Mar 19, 2014, 8:52:17 AM3/19/14
to aran...@googlegroups.com
Hi Jan,
Thank you for the amazingly fast reaction, I've tried your your solution:

FOR m IN setting 
   FILTER IS_STRING(m.statistics) && 
          LIKE(m.statistics, '%INT%', true) && 
          m.entity == 'skill' 
   RETURN m

But it resolves to the same error:

[1542] invalid argument type used in call to function 'LIKE()'

Cheers, Carlos

Jan Steemann

unread,
Mar 19, 2014, 9:02:25 AM3/19/14
to aran...@googlegroups.com
It seems like there are documents in the collection "setting" which have
an invalid type of their "statistics" attribute.

The FILTER condition should filter those out and keep only those
documents with a string attribute "statistics".

I don't see a particular problem with the adjusted query. Can you let me
know which version of ArangoDB you are using? And could you provide some
example values for the "statistics" attribute? I used strings, booleans,
nulls and "not present" when I tried the query.

Thank you and best regards
Jan

Carlos Kelkboom

unread,
Mar 19, 2014, 9:17:06 AM3/19/14
to aran...@googlegroups.com
I'm using: Server Arango 1.4.3, I use the AQL Editor to test the queries.

If I run:
m IN setting FILTER IS_STRING(m.statistics) && m.entity == 'skill' RETURN m

I get all the skills of my RPG setting in my setting collection. This works perfectly. Even when I filter like this:
FOR m IN setting FILTER IS_STRING(m.statistics) && m.statistics == 'INT' && m.entity == 'skill' RETURN m

It all works. Only when I add the LIKE function I get the error:
FOR m IN setting FILTER IS_STRING(m.statistics) && LIKE(m.statistics, 'INT') && m.entity == 'skill' RETURN m

If you want I can try and extract all the data from the collection and mail it, the data is not actually mine so attaching it might be a bit sensitive,

Cheers, Carlos

Jan Steemann

unread,
Mar 19, 2014, 9:20:16 AM3/19/14
to aran...@googlegroups.com
I don't think you need to send data.

I think the problem is due a problem in an older version of ArangoDB
which should have been fixed last year.
Your version 1.4.3 is from last November, the most recent 1.4 release is
1.4.13 and should fix this problem.

Best regards
Jan

Carlos Kelkboom

unread,
Mar 19, 2014, 9:22:29 AM3/19/14
to aran...@googlegroups.com
Hi, 
I will upgrade asap. Thank you for your help!
Cheers, Carlos

Carlos Kelkboom

unread,
Mar 19, 2014, 11:33:32 AM3/19/14
to aran...@googlegroups.com
This fixed the problem. Thank you, we can close this item.

Jan Steemann

unread,
Mar 19, 2014, 11:35:58 AM3/19/14
to aran...@googlegroups.com
Thanks for confirming! I'm happy it works now.

Just out of curiosity:
I understood you're developing an RPG with ArangoDB. This sounds pretty
interesting. Is there a public game website etc. to look at?
If the project is non-public and/or you don't want to share, please just
ignore my question.

Thank you and best regards
Jan

On 19.03.2014 16:33, Carlos Kelkboom wrote:
> This fixed the problem. Thank you, we can close this item.
>
Message has been deleted

Jan Steemann

unread,
Mar 20, 2014, 9:17:36 AM3/20/14
to Carlos Kelkboom, aran...@googlegroups.com
Thanks! Looking forward to seeing it!

On 20.03.2014 14:10, Carlos Kelkboom wrote:
> Hi,
>
> I'm actually building a sort of CMS for backend applications in arango,
> nodejs and angularjs. One of the applications I'm building to test the
> progress of my CMS is a web application for a Pen and Paper RPG. So far
> all three components are amazing me every day with their flexibility and
> power, arangoDB has been a very big part of the fast progress I'm making.
>
> I don't have a website for the RPG thingy yet, but once it's done I will
> certainly release it for people to enjoy. I will drop a line when it's done.
> Cheers,
> Carlos Kelkboom

Carlos Kelkboom

unread,
Mar 20, 2014, 9:18:30 AM3/20/14
to aran...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages