excludeFromIndexes()
// Your model declaration
const options = { explicitOnly: false };
const blogPostSchema = new Schema({
title: { type: String }
}, options);
BlogPost = gstore.model('BlogPost', blogPostSchema);
...
// Yout controller
const blogPost = new BlogPost({
title:'my-title',
text:`some very long text that can not be indexed because of the limitation
of the Datastore where the max length is 1,500 bytes for text properties.
It takes 1 to 6 bytes for 1 UTF-8 char ~= 500 characters`
});
/*
If you save this entity, the text won't be saved in the Datastore
because of the size limitation of the indexes (can't be more that 1500 bytes).
https://cloud.google.com/datastore/docs/concepts/limits
Assuming that the "text" propery is dynamic and is not known at Schema instantiation,
you need to remove the propery from indexes before saving.
*/
BlogPost.excludeFromIndexes('text');
// now you can save the entity
blogPost.save().then(() => { ... });Last updated
Was this helpful?