MongoDB – How to remove all documents in a MongoDB collection

MongoDB – How to remove all documents in a MongoDB collection

Category:

To remove all documents in a MongoDB collection (from the command line) use the remove function, and give it an empty set of parentheses, like this:

// remove all documents in the "stickynotes" collection
db.stickynotes.remove({})

You can do the same thing from your Java, Scala, Ruby, Python, PHP, etc. code, just created an empty MongoDbObject and supply it as an argument to remove(). (Of course you’ll want to test this somewhere besides your production systems.)

http://alvinalexander.com/source-code/scala/mongodb-how-remove-all-documents-mongodb-collection

What is Hibernate Caching?

While working with Hibernate web applications we will face so many problems in its performance due to database traffic. That to when the database traffic is very heavy . Actually hibernate is well used just because of its high performance only. So some techniques are necessary to maintain its performance. Hibernate Caching is the best technique to solve this problem. In this article we will discuss about, how we can improve the performance of Hibernate web applications using caching.

The performance of Hibernate web applications is improved using caching by optimizing the database applications. The cache actually stores the data already loaded from the database, so that the traffic between our application and the database will be reduced when the application want to access that data again. Maximum the application will works with the data in the cache only. Whenever some another data is needed, the database will be accessed. Because the time needed to access the database is more when compared with the time needed to access the cache. So obviously the access time and traffic will be reduced between the application and the database. Here the cache stores only the data related to current running application. In order to do that, the cache must be cleared time to time whenever the applications are changing.

– See more at: http://www.javabeat.net/introduction-to-hibernate-caching/#sthash.7QEMP0I2.dpuf

What is Hibernate Caching?

Java Search Algorithms

Search algorithm is an algorithm for finding an item with specified properties among a collection of items. The items may be stored individually as records in a database or may be elements of a search space defined by a mathematical formula or procedure, such as the roots of an equation with integer variables or a combination of the two.

You can find examples for different types of search algorithms here.

– See more at: http://www.java2novice.com/java-search-algorithms/#sthash.KbYxAkkS.dpuf

neo4j visualization with JSF: integration with Vivagraph SVG, simple example from tutorial

In the internet a lot of question how to show graph in the web page, mostly asked from java developers.
A lot of js technologies support neo4j visualization , but how to pass data from java to js in the web page?
Imagine you have already graph object from java – nodes and links. I used Vivagraph SVG for this example. You can extend it.

First we have JSF bean which contains our simpe graph nodes and edges, like
bean

After we change the Vivagraph SVG simple example code, passing values from JSF bean, instead static data which you can find in the example.
web

You can see that
I used
graph.addNode(‘${graphBean.firstNode}’, ’91bad8ceeec43ae303790f8fe238164b’);
graph.addNode(‘${graphBean.secondNode}’, ‘d43e8ea63b61e7669ded5b9d3c2e980f’);

graph.addLink(‘${graphBean.firstNode}’, ‘${graphBean.secondNode}’);

instead of
graph.addNode(‘anvaka’, ’91bad8ceeec43ae303790f8fe238164b’);
graph.addNode(‘indexzero’, ‘d43e8ea63b61e7669ded5b9d3c2e980f’);
graph.addLink(‘anvaka’, ‘indexzero’);

as a result

result

Get Example from https://github.com/anvaka/VivaGraphJS/tree/3b2da1f87c90363a50427efb039b277eac523cad/demos