SAVE
entity.save(
/* {Transaction} -- optional. Will execute the save operation inside this transaction */
<transaction>,
/* {object} -- optional. Additional config */
<options>
)options
{
method: 'upsert|insert|update', // default: 'upsert'
}// blog-post.model.js
const { instances } = require('gstore-node');
const gstore = intances.get('default');
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?