When you want to display how many records your collection has without displaying them. You can pass filter and paging parameters to filter records upfront and get the amount of filtered records.
You register employees from when to when s/he wants to travel, in which country, and you can attach documents related to the business trip. You can use our templates or create collections and taxonomies manually by following our instructions.
Prerequisites:
Create Employees collection and other related taxonomies from the template. See instructions here.
Create a collection of "Business Trips." You can do it manually or just copy-paste JSON and UI schemas into CodeMash Dashboard. See instructions here. The schema itself can be found here.
Let's say you have some records inserted in the "Business Trips" collection.
Let's get all the amount of records in the collection.
Please remember you need to initialize Repo first to avoid getting a NullReference exception. See how you can do that by following this link.
Coming Soon
Coming Soon
Let's filter some records by date ranges.
Let's find business trips that will start in 10 days. We store the "From" data field in CodeMash as a date field, which converts at the end as a UNIX timestamp. See more about the Date field.
Let's find business trips that will start in 10 days. We store the "From" data field in CodeMash as a date field, which converts at the end as a UNIX timestamp. See more about the Date field.
And last one example. Let's find all employee business trips that are planned for the future.
We assume that:
We have a country we are interested in - taxonomy term Id. E.g., We can fetch all terms from the taxonomy called countries and find the term Id of France.
We have a country we are interested in - taxonomy term Id. E.g., We can fetch all terms from the taxonomy called countries and find the term Id of France.
We have an employee Id - employee
We have a date from, e.g., DateTime.Now converted to the Unix time in milliseconds
IRepository<BusinessTrip> Trips { get; set; }var f =Builders<BusinessTrip>.Filter;var from =f.Gte(x =>x.From, from);var inCountry =f.Eq(x =>x.CountryId, country);var withEmployee =f.ElemMatch(x =>x.Employees, x =>x.EmployeeId== employee);var tripsCount =awaitTrips.CountAsync(from & inCountry & withEmployee);
So in the example above, we found the number of future trips of one particular employee to one country.
Error with https://760328771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LwSkuCpTNI_AerL8J2a%2Fuploads%2FCpzJktmKXD6FMPSah1nK%2Fopenapi.json?alt=media&token=854cdd6a-61b2-49a5-99f4-6bc091e5c3d6: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation UpdateManyRequestdbCollectionNamebulk_Update has multiple requestBodies
Error with https://760328771-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LwSkuCpTNI_AerL8J2a%2Fuploads%2FCpzJktmKXD6FMPSah1nK%2Fopenapi.json?alt=media&token=854cdd6a-61b2-49a5-99f4-6bc091e5c3d6: Failed to convert Swagger 2.0 to OpenAPI 3.0: Operation UpdateManyRequestdbCollectionNamebulk_Update has multiple requestBodies