Hi Rion, it's very easy: store the array of document (or collection of document) as field in place of single one.
Lvc@ On 9 February 2014 21:18, Rion <[email protected]> wrote: > Hi everyone, > > I'm new to OrientDB and would like to use it in my next project. My > problem is that I can't figure out how to save array or Lists when using > the Document DB mode. I see from the example given on the wiki that I can > nest ODocuments, but I seem to be missing the syntax for arrays. Here is > the example I'm looking at: > > // OPEN THE DATABASE SERVER AND DB WITH THE SPECIFIED DB SERVER > CREDENTIALS > ODatabaseDocumentTx db = new > ODatabaseDocumentTx("remote:localhost/blah").open("admin", "admin"); > > // CREATE A NEW DOCUMENT AND FILL IT > ODocument doc = new ODocument("Person"); > > doc.field( "name", "Luke" ); > doc.field( "surname", "Skywalker" ); > doc.field( "city", new > ODocument("City").field("name","Rome").field("country", "Italy") ); > > // SAVE THE DOCUMENT > doc.save(); > > > The line: "doc.field( "city", new > ODocument("City").field("name","Rome").field("country", "Italy") );" ends > up creating a new class in the DB called 'City' and populates it with this > entry. Extending this example, I would like to store a list of Cities > rather than a single one. > > Any pointers are appreciated. > > Thanks, > Rion > > -- > > --- > You received this message because you are subscribed to the Google Groups > "OrientDB" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
