title: OrientDB - create document with subquery and relationship
body: <p>I'm new to OrientDB and I'm developing a test application for internal use (orientdb 2.2.17).</p>
  
  <p>I'm trying to add a new document to class with a subquery as one of the values.</p>
  
  <p><strong>Classes:</strong></p>
  
  <pre><code>CREATE CLASS Website
  CREATE PROPERTY Website.id String
  CREATE PROPERTY Website.name String
  CREATE PROPERTY Website.created DateTime
  
  CREATE CLASS User
  CREATE PROPERTY UserEndpoint.id String
  CREATE PROPERTY UserEndpoint.website String 
  CREATE PROPERTY UserEndpoint.created DateTime
  </code></pre>
  
  <p>I'm trying to add a new user with a reference to some website.</p>
  
  <p>For example:</p>
  
  <pre><code>INSERT INTO Website (name) VALUES ('localhost:8090')
  </code></pre>
  
  <p>And after that to add user:</p>
  
  <pre><code>INSERT INTO User (website) VALUES (SELECT id FROM Website WHERE )
  OR
  INSERT INTO User (website) VALUES (SELECT @rid FROM Website WHERE )
  </code></pre>
  
  <p>The results are not what I'm expecting, the <code>User.website</code> parameter is a string that represents an array, instead of a string that represents a single value.</p>
  
  <pre><code> {
       "result": [
           {
               "@type": "d",
               "@rid": "#30:0",
               "@version": 1,
               "@class": "User",
               "created": "2017-12-28T16:35:31",
               "id": "a9816adc-8808-4673-b5a7-b11493b0ce36",
               "website": "[Website#25:0{created:Thu Dec 28 16:34:25 UTC 2017,id:e0ce0e68-003b-4a01-8c4f-856d9eeb6125,name:localhost:56} v1]"
           }
       ]
       "notification": "..." }
  </code></pre>
  
  <p>Expected:</p>
  
  <pre><code> {
       "result": [
           {
               "@type": "d",
               "@rid": "#30:0",
               "@version": 1,
               "@class": "User",
               "created": "2017-12-28T16:35:31",
               "id": "a9816adc-8808-4673-b5a7-b11493b0ce36",
               "website": "#25:0"
           }
       ]
       "notification": "..." }
  </code></pre>
  
  <p>And I also want to make a relationship between website and users (user belong to one website and website might have a lot of users), is this is the right way:</p>
  
  <pre><code>CREATE LINK websiteUsers TYPE LINKSET FROM User.website TO Website.rid
  </code></pre>
  
  <p>?</p>
  
  <p>And while I query for a user and I want to get website details, did the add automatically to result?</p>