Skip to content

Query on variable of nested object #32

Answered by cbaker6
vdkdamian asked this question in Q&A
Discussion options

You must be logged in to vote

Your code will probably look something like below (the guides I posted in #32 (reply in thread) further explain why):

let clothesQuery = Category.query("name" == "Clothes")
let productQuery = Product.query(matchesKeyInQuery(key: “category”,
                                                           queryKey: “name”,
                                                           query: clothesQuery))
do {
  let results = try await productQuery.find() // You should only use findAll when necessary is this isn’t an optimal query, you should only request what you need from the server
  print(results)
} catch {
  // Handle error
}

Note that if you don’t find something in the Playgrounds, it’s recom…

Replies: 4 comments 14 replies

Comment options

You must be logged in to vote
4 replies
@cbaker6
Comment options

@vdkdamian
Comment options

@vdkdamian
Comment options

@cbaker6
Comment options

Comment options

You must be logged in to vote
2 replies
@vdkdamian
Comment options

@jaysonng
Comment options

Comment options

You must be logged in to vote
1 reply
@vdkdamian
Comment options

Answer selected by vdkdamian
Comment options

You must be logged in to vote
7 replies
@vdkdamian
Comment options

@cbaker6
Comment options

@vdkdamian
Comment options

@jaysonng
Comment options

@vdkdamian
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants