Skip to content

naskarlab/fluent-query-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fluent Query MongoDB

Create Queries using only POJO classes and MongoDB Driver.

See more example in: Fluent Query

Features

  • Configuration over code: independence business code of the infrastructure code;
  • Intrusive-less: zero or less changes for your code;
  • Glue code: it’s only a small and simple classes set;
  • Fluent Builder: code complete is your friend!

Examples


MongoDatabase database = client.getDatabase("testdb");
		
DatabaseProvider databaseProvider = new DatabaseProvider() {
	@Override
	public MongoDatabase getDatabase() {
		return database;
	}
}; 

DAO dao = new DAOImpl(databaseProvider);

dao.execute(dao.insert(Customer.class)
	.value(x -> x.getId()).set(UUID.randomUUID().toString())
	.value(i -> i.getName()).set("test1"));
				
List<Customer> actual = dao.list(dao.query(Customer.class)
		.where(i -> i.getName()).like("t%"));
			

Usage with Maven

<repositories>
	<repository>
	    <id>jitpack.io</id>
	    <url>https://jitpack.io</url>
	</repository>
</repositories>

<dependency>
    <groupId>com.github.naskarlab</groupId>
    <artifactId>fluent-query-mongodb</artifactId>
    <version>0.0.1</version>
</dependency>

About

Create Queries using only POJO classes and MongoDB Driver.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages