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'))
);
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745215206a4616976.html
评论列表(0条)