Skip to content
This repository was archived by the owner on Jan 3, 2021. It is now read-only.
This repository was archived by the owner on Jan 3, 2021. It is now read-only.

New Query Syntax Docs #23

@olbrichj

Description

@olbrichj

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.

class Test: Model {
    var _id = IdObject()
    var symbol: Symbol
}

class Symbol: Codable {
    var name: String
    var number: Int
}

With this setup I'm trying to find documents by name or number (or even both).

let context = manager?.makeContext()
let query: Query = "symbol.name" == "Test"
let result = try? context?.findOne(Test.self, where: query).wait()

Or trying to have name on toplevel:

class Test: Model {
    var _id = IdObject()
    var name: String
}

let context = manager?.makeContext()
let query: Query = "name" == "Test"
let result = try? context?.findOne(Test.self, where: query).wait()

All of these result in nil. I've also tried to create the corresponding syntax:

[
  "name" : [
    "$eq" : 
    "Test"
  ]
]

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions