Reputation: 3674
I have a simple Query which is there to recommend Users under a Post related Posts.
await this.$fireStore.collection('posts')
.limit(6).where('tags', 'array-contains', this.post.tags[0]).get().then(querySnapshot => {
Problem is that this also Reads out the Post itself (since it contains the Tag too), is there any way to query for Posts that dont have a specific DocID without wasting a Where ergo needing a complete new Query?
Upvotes: 0
Views: 38
Reputation: 83093
Firestore doesn't provide the possibility to query with inequality (i.e. not equals), see for example this SO post: Firestore: how to perform a query with inequality / not equals
I understand that you want to get a maximum of 6 "sibling" posts. You could make the same query, with a limit of 7 docs and, in your front-end, filter the result:
By looping over the list of docs and compare their Id to the current doc Id you will encounter two cases:
Upvotes: 1