Support Center & Knowledge base

Add a query


Add a Query

Within Read/Accounts/ create a file called AllDebitAccounts.cs with the following content:

using System.Linq;
using Dolittle.Queries;
using MongoDB.Driver;

namespace Read.Accounts
    public class AllDebitAccounts : IQueryFor<Account>
        public AllDebitAccounts(IMongoCollection<Account> collection) => Query = collection?.Find(_ => _.Type == AccountType.Debit).ToList().AsQueryable();

        public IQueryable<Account> Query { get; }

In the next part of the tutorial you learn how to create the Aurelia front-end.