How to insert data as a JSON object in Gremlin
Currently, the following query is used to insert person object with some properties:
g.addV('person').property('firstName', 'Thomas').property('lastName', 'Andersen').property('age', 44).property('userid', 101)
With the above approach, I have to call .property()
method for each attribute and there could be more than 50 attributes in my object/class.
Is ther anyway to insert the complete object in one call
var personData = {
firstName: 'Thomas',
lastName: 'Andersen',
age: 44,
userid: 101
};
g.addV('person', personData);
// OR
g.addV('person').data(personData);
Please note that, I am using MS Cosmos DB Gremlin API with NodeJs.