admin管理员组文章数量:1415684
I have a question which I'm hoping someone could answer as it's been two days I'm trying to sort it with absolutely no luck.
I have a collection of documents, so far so good..
Each of this documents has a field "preferred_time" that has a timestamp as a value.
Is it possible to sort the documents inside the collection using this value as reference?
I tried:
return this.afs.collection('viewings', ref =>
ref.orderBy('preferred_time')
);
but it doesn't seem to work with timestamps field types.
Please help!!
Thanks, M.
I have a question which I'm hoping someone could answer as it's been two days I'm trying to sort it with absolutely no luck.
I have a collection of documents, so far so good..
Each of this documents has a field "preferred_time" that has a timestamp as a value.
Is it possible to sort the documents inside the collection using this value as reference?
I tried:
return this.afs.collection('viewings', ref =>
ref.orderBy('preferred_time')
);
but it doesn't seem to work with timestamps field types.
Please help!!
Thanks, M.
Share Improve this question asked Apr 11, 2018 at 18:07 CyberpunkerCyberpunker 1131 gold badge2 silver badges9 bronze badges1 Answer
Reset to default 5You can sort your preferred_time on desc or asc. Read more here: https://firebase.google./docs/firestore/query-data/order-limit-data
return this.afs.collection('viewings', ref =>
ref.orderBy('preferred_time','desc'))
);
本文标签: javascriptAngular Firestore Sorting documents by timestamp valueStack Overflow
版权声明:本文标题:javascript - Angular Firestore Sorting documents by timestamp value - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745215206a2648122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论