Doing queries across documents

22 views
Skip to first unread message

Dofs

unread,
Jun 1, 2012, 9:29:45 AM6/1/12
to ravendb
Hi,

I want to learn more about the NoSQL databases, and specific RavenDB.
I have therefore thought of creating a small mashup with data from
Google+, Twitter and perhaps Facebook. I am trying to design the
upcomming RavenDB database, and have a few very beginner-like
questions, so please bare with me.

Since there can be quite a lot of data I wanted to structure the
documents like this, so I avoid too large documents:

Items/GooglePlus/{date}
Items/Twitter/{date}
Items/Facebook/{date}

The issue I am therefore having is if this is a wrong approach, if I
e.g. want to do queries like: Give me the 10 latest posts across the 3
documents.

The reason why I don't want to store the data in just one document, is
because of their different structure, but maybe this isn't an issue
with the NoSQL databases since it doesn't have schemas?

Chris Marisic

unread,
Jun 1, 2012, 10:37:42 AM6/1/12
to rav...@googlegroups.com
I would likely store the data in 1 document type

Social { id: "items/{source}/{some kind of datestamp}",  List<Item> { string Content, string Time} }

This would give you cleanly partitioned documents

You could then write a single index that selects the Items from the Social containers so you can display the last 10 things ordered by Time, etc.

Chris Marisic

unread,
Jun 1, 2012, 11:14:07 AM6/1/12
to rav...@googlegroups.com
string Time should really have been DateTime or DateTimeOffset

Dofs

unread,
Jun 2, 2012, 3:33:15 AM6/2/12
to ravendb
Thank you for your answers.

To clarify a bit. The reason why I want to create different documents
for Facebook, Google+ and Twitter is because they have different data
they return. Twitter have their name + status, Facebook name, status,
video url etc.

When you Chris write List<Item> Content, is this then just a string
with the text, or the json result from the social API?
Reply all
Reply to author
Forward
0 new messages