Hi guys,
We helped on building a high-volume chat application by modeling the
metadata about who started/discuss, but then using the document API with no
index to have super fast access to last X messages. In facts, OrientDB
stores new records in append only, and the @rid is auto generated as
incrementing. So if you just create the message in the chat with
ODocument msg = new ODocument("Message");
msg.field( "date", new Date() );
msg.field( "text", iText );
...
msg.save();
Then you can retrieve last 50 messages with:
*select from Message order by @rid desc skip 0 limit 50*
To load the 2nd (last) page:
*select from Message order by @rid desc skip 50 limit 50*
This is super fast and O(1) even with million of messages.
Best Regards,
Luca Garulli
CEO at Orient Technologies LTD
the Company behind OrientDB
http://about.me/luca.garulli
On 25 May 2015 at 16:32, <[email protected]> wrote:
> Hi Brett,
> try this SQLquery select name,in('Discuss').roomId from (select
> expand(out('Started').out('Discuss')) from User where name = 'julie')
>
> Bye, Alessandro
>
>
> Il giorno sabato 23 maggio 2015 04:17:19 UTC+2, Brett Coffin ha scritto:
>>
>> I am building a chat room engine and I have a graph like so:
>>
>> User---Started--->Room----Discuss--->Item<---Own---User
>>
>> I would like to get all the Items and the roomId associated to the Item
>> for a particular User.
>>
>> select
>> *, in('Discuss').in('Started')[name ='julie'] as roomId
>> from item
>>
>> so this is going threw the right 'Room' and finds the one started by
>> 'Julie' but it returns Julie's Id, how do I get with this query the Id of
>> that room ? It's like i need to do a 'one back' and get @rid...
>>
>> I am new to graphs so any pointers would be appreciated.
>>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OrientDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.