Given a stringId key for an entity, how do I check if there is a corresponding entity in datastore. I do not want to fetch the entity completely. I want to check if the entity exists or not.
Is there a performance impact if I fetch the complete entity to check its existence? Or is there a better way?
var Person struct {
stringId string //string id which makes the key
//many other properties.
}
//insert into datastore
_, err := datastore.Put(ctx, datastore.NewKey(ctx, entityKind, stringId, 0, nil), entity)
//retrieve the entity
datastore.Get(ctx, datastore.NewKey(ctx, entityKind, stringId, 0, nil), entity);
Instead of retrieving complete entity for a given stringId, is there a better way to check the entity exists?