David Laberge
David Laberge

Reputation: 16051

OrientDB specify cluster from JSON structure

Working with OrientDB document 2.1.11

I'm trying to save a document from a JSON object, but I need the subObject in it to be inserted in a specific cluster. Is there a way to tell OrientDb to save in a cluster from the JSON

Here is an example of the JSON to be save :

{
  "@rid":"#18:0",
  "@class":"Supplier",
  "@type":"d",
  "@version":1,
  "code":"SUP1",
  "active":true,
  "language":"en",
  "divisions":[  // LinkList
    {
      "@class":"Division",
      "code":"tre",
      "rate":"5",
      "@type":"d",
      "description":{
        "fr":"",
        "en":"rew"
      }      
    }
  ],
"createdDate":"2016-05-04 09:24:35",
"name":"Supplier1",
"currency":"CAD"
}

How to I specify that @class:"Division has to be in a specific cluster? Can the subObject in a JSON structure indicate wich cluster has to be updated?

I'm using the JAVA API database.save(doc, "supplier_1") to save the Supplier object is a specific cluster (i.e: "supplier_1").

Upvotes: 0

Views: 35

Answers (1)

Ivan Mainetti
Ivan Mainetti

Reputation: 1982

I don't think it's possible doing that as you can read here , records stored in embedded types has no @rid so, as long as they're contained inside the main record, you can't put'em into a specific cluster.

Hope it helps. Ivan

Upvotes: 0

Related Questions