Skip to content

Moebius.DocumentQuery return only one entry? #98

Open
@madasebrof

Description

@madasebrof

Not sure if this is a bug or a feature request, but I'm wondering how to return a single entry. For example, I have a series of entries that are similar but just have different ids and "created_at" fields (e.g. like a log file). I only want to get the most recent one. I thought it would work like this:

db(:my_db)
   |> search(for: "/users/accounts", in: [:name])
   |> sort(:id, :desc)
   |> limit(1)
   |> Polo.Db.run

but this returns all entries that match "/users/accounts".

When I inserted it, I used:

db(:my_db)
   |> searchable([:name])
   |> Polo.Db.save(name: name, value: body)

Any help is most appreciated!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions