Skip to content

Commit 08fb937

Browse files
committed
improve mongo filter function
1 parent 3ce3c5c commit 08fb937

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

README.md

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ If you liked the project or if `netcorekit` helped you, please give a star so th
1414

1515
### Features
1616

17-
- Simple libraries. No frameworks. Little abstraction.
18-
- Opt-in and out of the box [features](https://github.com/cloudnative-netcore/netcorekit/wiki/Miniservice-template-guidance) with [Feature Toggles](https://martinfowler.com/articles/feature-toggles.html) technique.
19-
- Generic repository for data persistence.
20-
- Adhere to [twelve-factor app paradigm](https://12factor.net) and more.
21-
- Resilience and health check out of the box.
22-
- Easy for configuration management.
23-
- [Domain-driven Design](https://en.wikipedia.org/wiki/Domain-driven_design) in mind.
24-
- Simply [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) supports.
25-
- Authentication/Authorization with OAuth 2.0 and OpenID Connect.
26-
- Clean and demystify error, debug logs.
27-
- API versioning from Docker container to WebAPI.
28-
- Documentation template with OpenAPI documentation.
29-
- Work natively with Kubernetes or even with Service Mesh(Istio).
17+
- [x] Simple libraries. No frameworks. Little abstraction.
18+
- [x] Opt-in and out of the box [features](https://github.com/cloudnative-netcore/netcorekit/wiki/Miniservice-template-guidance) with [Feature Toggles](https://martinfowler.com/articles/feature-toggles.html) technique.
19+
- [x] Generic repository for data persistence.
20+
- [x] Adhere to [twelve-factor app paradigm](https://12factor.net) and more.
21+
- [x] Resilience and health check out of the box.
22+
- [x] Easy for configuration management.
23+
- [x] [Domain-driven Design](https://en.wikipedia.org/wiki/Domain-driven_design) in mind.
24+
- [x] Simply [Clean Architecture](http://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) supports.
25+
- [x] Authentication/Authorization with OAuth 2.0 and OpenID Connect.
26+
- [x] Clean and demystify error, debug logs.
27+
- [x] API versioning from Docker container to WebAPI.
28+
- [x] Documentation template with OpenAPI documentation.
29+
- [x] Work natively with Kubernetes or even with Service Mesh(Istio).
3030

3131
## Less code to get starting
3232

@@ -85,15 +85,10 @@ public class Startup
8585
}
8686
```
8787

88-
<details>
89-
<summary>More guidances to get starting</summary>
90-
9188
- Read [Get starting](https://github.com/cloudnative-netcore/netcorekit/wiki/Get-Started) section and [Play with Kubernetes](https://github.com/cloudnative-netcore/netcorekit/wiki/Deploy-on-k8s-on-local) section to know more about this cloud-native toolkit.
9289
- Basic usage can be found at [TodoApi Sample](https://github.com/cloudnative-netcore/netcorekit/tree/master/samples/TodoApi)
9390
- More advance usage is at [Coolstore Microservices](https://github.com/vietnam-devs/coolstore-microservices) project.
9491

95-
</details>
96-
9792
### Contributing
9893

9994
1. Fork it!

src/NetCoreKit.Infrastructure.Mongo/MongoQueryRepositoryExtensions.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,11 @@ public static async Task<TEntity> FindOneAsync<TEntity, TId>(
2424

2525
public static async Task<IReadOnlyList<TEntity>> FindListByFieldAsync<TEntity>(
2626
this IMongoQueryRepository<TEntity> repo,
27-
string fieldName,
28-
string fieldValue,
27+
Expression<Func<TEntity, bool>> filter = null,
2928
CancellationToken cancellationToken = default(CancellationToken))
3029
where TEntity : class, IAggregateRoot
3130
{
3231
// only use it if you don't have other solutions :p
33-
var filter = Builders<TEntity>.Filter.Eq(fieldName, fieldValue);
3432
return await repo
3533
.DbContext
3634
.Collection<TEntity>()

0 commit comments

Comments
 (0)