for Using MongoDB as node & property
bleujin/mongoNode
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
<h1>MongoNode - Mongo Driver as Node & Property Structure(Craken Style)</h1> <h2>Quick start</h2> <p></p> RepositoryCentral rc = new RepositoryCentral("mongo address", port) ; Session session = rc.testLogin("wname") ; session.newNode().put("name", "bleujin").put("age", 20) ; session.commit() ; Node node = session.createQuery().eq("name", "bleujin").lte("age", 30).ascending("age").findOne() ; ... rc.unload() ; <p>sample test code. for more example, confirm test/net/ion/radon/repository/TestAllRepository.java</p> <pre><code> @Override protected void setUp() throws Exception { super.setUp(); RepositoryMongo rm = RepositoryMongo.testLocal() ; this.session = rm.login("test", "wsname") ; } protected void tearDown() throws Exception { session.workspace().repository().shutdown() ; super.tearDown(); } public void testFirst() throws Exception { session.collection().drop() ; session.tranSync(new WriteJob<Void>(){ public Void handle(WriteSession wsession) { wsession.pathBy("/bleujin").property("name", "bleujin").property("age", 20) ; return null; } }) ; assertEquals("/bleujin", session.pathBy("/bleujin").fqn().toString()) ; assertEquals("bleujin", session.pathBy("/bleujin").property("name").asString()) ; } public void testFindByPath() throws Exception { session.tranSync(new WriteJob<Void>() { @Override public Void handle(WriteSession wsession) { wsession.pathBy("/bleu").property("name", "bleu").child("jin").property("name", "jin").child("hero").property("name", "hero"); return null; } }); assertEquals("bleu", session.pathBy("/bleu").property("name").asString()); assertEquals("jin", session.pathBy("/bleu/jin").property("name").asString()); assertEquals("hero", session.pathBy("/bleu/jin/hero").property("name").asString()); } </code></pre>
About
for Using MongoDB as node & property
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published