Hi,
Thanks a lot for your reply!
On Friday, April 20, 2012 3:38:44 PM UTC+2, Lvc@ wrote:
E.g. something like this proposal for MongoDB: https://jira.mongodb.org/browse/SERVER-736?
I'm very interested in querying e.g. all documents that contain a certain key/field somewhere, but it is not known at which depth.
1) Does OrientDB support something like XPath for querying JSON documents?
Hi,
course! This is a graphdb afterall :-)
You can use the DOT (.) to traverse links or embedded documents. Example:
OK.
or in a graph of unknown size and deep the TRAVERSE operator helps:
select from ( traverse * from customer ) where name = 'Austria'
Aha! The traverse trick is very cool. Didn't know about it.
2) Does OrientDB index JSON documents somehow to speedup queries? How it does it? How many levels of JSON documents can be indexed?
OrientDB has indexing. You mean embedded/nested records?
Yes. Sure it has indexing. And indeed, I meant embedded/nested complex JSON documents, which have several levels of nesting.
I understand that OrientDB can traverse them (the trick above), but how are they indexed? Do I need to add index manually by means of special command? Is it done automatically? If the nesting depth is not known in advance, can I still index something independent of the nesting level, e.g. based on a field name? Or can I only create indices for a few top-most levels?
3) Does OrientDB support something like XPath for querying graphs?
Exactly, but use the dot, not (.) the slash (/)
Very nice.
4) Compared to MongoDB, what are the pros and cons of OrientDB when working with JSON documents?
If you take JSON documents separated and connected there OrientDB is much faster because relationships are super optimized. Other benefits in comparison to MongoDB are the security, SQL and transactions.
Yes. Transactions are cool and a big advantage. But I have a few more questions:
1) Are server-side operations similar to MongoDB "inc"/"dec" are supported? (see e.g.
http://www.mongodb.org/display/DOCS/Updating#Updating-%24inc). The benefit of those is that you don't need to do the usual read/change/update, which saves a lot of time and avoids consistency problems and conflicting changes
2) Regarding transactions: I seem to remember that I read somewhere in the OrientDB docs that there can be at most one concurrent transaction for one cluster or one DB, or something like this. Unfortunately, I cannot find this place anymore. Is it just a misunderstanding on my side or there is indeed some sort of a limitation when using transactions?
Thanks,
Leo