Search code examples
jsonorientdb

OrientDB - Search by json attribute inside column


I have a graph with following structure:

  • @rid
  • @class
  • @version
  • content (json content)

The column _content_ stores a json like {"phoneNumber":"+5511999998888","date":"2017-05-09T18:23:31Z"}.

I would like to perform a search by date attribute where the value is lower than another value.

Is possible to run a query like that with the folowing structure? How can I write the select condition? I'm kinda new to OrientDB.


Solution

  • Let's say your vertex name is Person

    You can do :

    CREATE PROPERTY Person.content IF NOT EXISTS EMBEDDED
    SELECT * FROM Person WHERE content.date < "2017-05-09T18:23:31Z"
    

    Hope it helps