Insert Document without using SQL via JavaScript API

73 views
Skip to first unread message

Omega Silva

unread,
May 6, 2015, 11:59:51 PM5/6/15
to orient-...@googlegroups.com
Hi all,

The Java API facilitates creating documents in the following style;

ODocument newEmployee = new ODocument("Employee");
newEmployee.field("name", "John");
newEmployee.save();

Does the JavaScript API have something similar?

Cheers.
Omega

Luigi Dell'Aquila

unread,
May 7, 2015, 5:13:43 AM5/7/15
to orient-...@googlegroups.com
Hi Omega,

where are you executing this javascript code? Is it in a web page, in Node.js or inside OrientDB (eg. an OFunction)?



--

---
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 orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Omega Silva

unread,
May 14, 2015, 11:01:20 PM5/14/15
to orient-...@googlegroups.com
Hi Luigi,

Thanks for the response. I'm executing this inside OrientDB (OFunction).

Luigi Dell'Aquila

unread,
May 18, 2015, 3:38:15 AM5/18/15
to orient-...@googlegroups.com
Hi Omega,

you should be able to do something like

var newEmployee = db.newInstance("Employee");
newEmployee.field("name", "John");
newEmployee.save();

Luigi




Omega Silva

unread,
May 19, 2015, 9:14:23 PM5/19/15
to orient-...@googlegroups.com
Awesome! This works!!

Thanks Luigi
Reply all
Reply to author
Forward
0 new messages