orientechnologies / orientjs

The official fast, lightweight node.js client for OrientDB
http://orientdb.com
Other
326 stars 67 forks source link

Querybuilder: RID formatting issue #59

Open Ineluki opened 9 years ago

Ineluki commented 9 years ago

I have a query like this:

    Database.insert().into(TABLE).set({
        title : title,
        created_by : userRecordId,
        date_created : new Date(),
        status : 'OPEN',
        ruleset : rulesetRecordId
    }).one();

Where rulesetRecordId would be something like string:"#12:1". However, that fails with the message:

"Error on execution of command: sql.INSERT INTO Test SET title = "test", created_by = #14:1, date_created = date("2015-08-01 07:23:05.317", "yyyy-MM-dd HH:mm:ss.SSS", "UTC"), status = "OPEN", ruleset = "#12:1""

As you can see, the created_by is a RID-Object returned from another query and is inserted correctly, while ruleset is brought back from a String. I have not found a format that the query builder will accept for the ruleset-RID! What way is there, short of first loading the ruleset-record itself via another query? Formats that do not work include:

Great database, but the documentation is seriously lacking for such standards

wolf4ood commented 8 years ago

@Ineluki did you declare ruleset field as link in Test class?

wolf4ood commented 8 years ago

hi @Ineluki you should construct the RID object in this way

Database.insert().into(TABLE).set({
        title : title,
        created_by : userRecordId,
        date_created : new Date(),
        status : 'OPEN',
        ruleset : OrientDB.RID(rulesetRecordId)
    }).one();
wolf4ood commented 8 years ago

hi @Ineluki

did you try it?