Properties
Virtual properties
const { instances } = require('gstore-node');
const gstore = intances.get('default');
const blogPostSchema = new gstore.Schema({
title: { type:'string' },
createdOn: { type:'datetime', default:gstore.defaultValues.NOW }
});
const BlogPost = gstore.model('BlogPost', blogPostSchema);
const data = {
title : 'My first blog post'
};
const blogPost = new BlogPost(data);
// Getter
// Logs the same value 'My first blog post'
console.log(blogPostEntity.title);
console.log(blogPostEntity.entityData.title);
// Setter
blogPostEntity.title = 'My second blog post'; // blogPostEntity.entityData.title is also changed
blogPostEntity.entityData.title = 'My third blog post'; // blogPostEntity.title is also changedLast updated
Was this helpful?