-
Notifications
You must be signed in to change notification settings - Fork 3
New Query Syntax Docs #23
Comments
There are two reasons you could be getting |
I will check again, when I'm back from work. The manager is present, as I use the same one to create the entries in MongoDB (which I can also find). Regarding the Query syntax. Is the above syntax also correct? |
The syntax is fine. I'm wondering, why is the manager is optional |
Oh that is just a relict of my testing trying to figure out how this works :D The optional will be removed in my next try |
So it seems like this is a bug in Xcode or llvm. It does return a document, but Xcode still displays it as nil. Unwrapping changes everything. But I have another question regarding the syntax. If I want to compare a value with a codable struct, is there any way to not compare every value explicitly? Given this structure: class Test: Model {
var _id = IdObject()
var address: Address
}
struct Address: Codable {
var street: String
var country: Country
}
enum Country: String, Codable {
case australia
} I can compare it explicitly: let query: Query = ("address.street" == testInstance.address.street) && ("address.country" == testInstance.address.country.rawValue What I'm looking for is something like this let query: Query = "address" = testInstance.address Furthermore I've seen the old syntax is like this: Test.findOne() { test in
return test.address.strees = "foo"
} Is there something similar? I found it for saving but didn't see anything for querying. testInstance.save(to: context) Last but not least, regarding the docs. Is there a specific format or a template to orientate? :) |
The current syntax would be like this: let query: Query = "address.street" == Country.australia.rawValue However, I think we have code that allows you to use raw enums directly, too: let query: Query = "address.street" == Country.australia |
I guessed why not, so I implemented what I think is a good design of this snippet in Meow 3: Test.findOne() { test in
return test.address.strees = "foo"
} |
That snippet for querying looks really neat :) Would also be great for Regarding the raw enum query I get the following error:
I tried extending the enum with Primitive, which doesn't result in a compile error but instead a runtime exception:
|
I'm trying to figure out how to use Meow 2.0.2. By now I figured out how to save but I'm totally lost regarding the Queries.
With this setup I'm trying to find documents by name or number (or even both).
Or trying to have
name
on toplevel:All of these result in
nil
. I've also tried to create the corresponding syntax:Which also didn't work. So I'm wondering... what is the correct way to query for documents in Meow 2.0?
I would be willing to help and write some docs, but I'd need to know how to use Meow first :D
The text was updated successfully, but these errors were encountered: