SAVE
entity.save(
/* {Transaction} -- optional. Will execute the save operation inside this transaction */
<transaction>,
/* {object} -- optional. Additional config */
<options>,
/* {function} -- optional. The callback, if not passed a Promise is returned */
<callback>
)options
{
method: 'upsert|insert|update', // default: 'upsert'
}// blog-post.model.js
const gstore = require('gstore-node')();
const blogPostSchema = new gstore.Schema({
title: { type: String },
createdOn: { type: Date, default: gstore.defaultValues.NOW }
});
module.exports = gstore.model('BlogPost', blogPostSchema);Saving inside a Transaction with middleware on Model
Last updated
Was this helpful?