An item that was saved to or retrieved from the database. The original object's fields can be accessed as usual, using either the dot or bracket notation.
var db = ScriptDb.getMyDb();
var item = db.save({
type: 'person',
name: 'fred',
age: 25
});
Logger.log('Name: ' + item.name);
Logger.log('Age: ' + item['age']);
Methods
Method | Return type | Brief description |
---|---|---|
getId() | String | Returns the item's id in the database. |
toJson() | String | Returns the JSON string representation of this object. |
Detailed documentation
getId()
Returns the item's id in the database. These ids are guaranteed to be unique within a given database.
Return
String
— the item's id in the database
toJson()
Returns the JSON string representation of this object.
Return
String
— the JSON string representation of this object