How does EmbeddedSet<String> work?

55 views
Skip to first unread message

Hung Tran

unread,
Mar 14, 2016, 4:44:05 AM3/14/16
to orient-...@googlegroups.com
Hi,

I am using OrientDB v2.1.8, I am not sure how to write a question to make at least 2 elements in a EmbededSet field

My sample data is


I have some queries


SELECT @rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINS 'b' => PASSED (2 results)
SELECT @rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINS ['b'] => FAILED (no result)
SELECT @rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINSALL 'b' => FAILED (no result)
SELECT @rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINSALL ['b'] => FAILED (no result)
SELECT @rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINS ['b','c'] => FAILED (no result)
SELECT
@rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINSALL ['b', 'c'] => FAILED (no result)
SELECT
@rid, EmailAddress, xMultiValue FROM Contact WHERE xMultiValue CONTAINSALL ['b', 'c', 'a'] => FAILED (no result)

Are they bugs?


My Best,
Hung Tran

alessand...@gmail.com

unread,
Mar 14, 2016, 9:21:16 AM3/14/16
to OrientDB
Hi,
with containsAll 'b', you don't get any records because containsAll returns all 
records where the xMultiValue property contains all the values "b"



Best regards,
Alessandro

Hung Tran

unread,
Mar 14, 2016, 10:56:58 AM3/14/16
to OrientDB
Hi Alessandro,

I don't really understand what the containsAll does, but I think your meaning is not correct. As my understanding, the containsAll for EmbeddedSet<string> means returning all records which contains all values of the subset.

For example, contains all ['b','c'] should return all records where the xMultiValue property contains all value in that subset.

Anyway, none of them are working.

My Best,
Hung Tran

alessand...@gmail.com

unread,
Mar 14, 2016, 11:55:56 AM3/14/16
to orient-...@googlegroups.com
Hi Hung,
as my undestanding, containsall 'b' will return all records where all values of xMultiValue property contains "b".

"true if all the elements of the collection satisfy the next condition".

Example



Only for the record #9:5 the property xMultiValue contains all values "b".

The record #9:0 contains also "a", #9:3 contain also "a" and "c" and #9:7 contains also "c" and "c"





Hope it helps.

Hung Tran

unread,
Mar 14, 2016, 12:22:44 PM3/14/16
to OrientDB
Hi Alessandro,

Thank you for helping me to understand it. By document, you seem to be right, but it seems to be not really useful. I really hope it has a different meaning which will return any record which the property contains all value of the given subset.

My Best,
Hung Tran
Reply all
Reply to author
Forward
0 new messages