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

http://www.javabeat.net/introduction-to-hibernate-caching/