GET
MyModel.get(
/* {int|string|Array<int|string>}. -- id(s) to retrieve */
<id>,
/* {Array} -- optional. ex: ['ParentEntity', 1234 ] */
<ancestors>,
/* {string} -- optional. A specific namespace */
<namespace>,
/* {Transaction} -- optional. The transaction currently in progress */
<transaction>,
/* {object} -- optional. Additional config */
<options>
)const BlogPost = require('./blog-post.model');
// id can be an integer or a string
BlogPost.get(123).then((entity) => {
console.log(entity.plain());
});
// Array of ids
BlogPost.get([1,2,3]).then((entities) => {
entities = entities.map(entity => entity.plain());
});
// Passing an ancestor path with a Kind and a name
const ancestors = ['Parent', 'parentName'];
BlogPost.get('stringId', ancestors).then((entity) => { ... });Last updated
Was this helpful?