Datastore Queries to retrive multiple values in GCP Nodejs

两盒软妹~` 提交于 2019-12-11 05:46:34

问题


How to retrieve multiple values in single field in datastore nodejs. code:

const query = datastore.createQuery('Task')
.filter('user_id', '=', [1,2,3])

.order('priority', {
descending: true
});

this is not working. I need query something like this

select userName from Table where user_id in (1, 2, 3);

回答1:


You can query to retrieve multiple values like the following:

If you have array of multiple datastore Id's like following:

[1,2,3,4]

You can query with gstore-node Package

var userData = await UserModel.get([1,2,3,4]);

Hope this will help you.

Thanks



来源:https://stackoverflow.com/questions/45553555/datastore-queries-to-retrive-multiple-values-in-gcp-nodejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!