|
|
@ -29,6 +29,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Initialize the collection helper
|
|
|
|
* Initialize the collection helper
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param database Instance of {@link MongoConnectionHandler}
|
|
|
|
* @param database Instance of {@link MongoConnectionHandler}
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public MongoCollectionHelper(@NotNull MongoConnectionHandler database) {
|
|
|
|
public MongoCollectionHelper(@NotNull MongoConnectionHandler database) {
|
|
|
@ -37,6 +38,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Create a collection
|
|
|
|
* Create a collection
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName the collection name
|
|
|
|
* @param collectionName the collection name
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void createCollection(@NotNull String collectionName) {
|
|
|
|
public void createCollection(@NotNull String collectionName) {
|
|
|
@ -45,6 +47,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Delete a collection
|
|
|
|
* Delete a collection
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName the collection name
|
|
|
|
* @param collectionName the collection name
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public void deleteCollection(@NotNull String collectionName) {
|
|
|
|
public void deleteCollection(@NotNull String collectionName) {
|
|
|
@ -53,6 +56,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Get a collection
|
|
|
|
* Get a collection
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName the collection name
|
|
|
|
* @param collectionName the collection name
|
|
|
|
* @return MongoCollection<Document>
|
|
|
|
* @return MongoCollection<Document>
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -62,6 +66,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Add a document to a collection
|
|
|
|
* Add a document to a collection
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName collection to add to
|
|
|
|
* @param collectionName collection to add to
|
|
|
|
* @param document Document to add
|
|
|
|
* @param document Document to add
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -72,6 +77,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Update a document
|
|
|
|
* Update a document
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName collection the document is in
|
|
|
|
* @param collectionName collection the document is in
|
|
|
|
* @param document filter of document
|
|
|
|
* @param document filter of document
|
|
|
|
* @param updates Bson of updates
|
|
|
|
* @param updates Bson of updates
|
|
|
@ -83,6 +89,7 @@ public class MongoCollectionHelper {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Delete a document
|
|
|
|
* Delete a document
|
|
|
|
|
|
|
|
*
|
|
|
|
* @param collectionName collection the document is in
|
|
|
|
* @param collectionName collection the document is in
|
|
|
|
* @param document filter to remove
|
|
|
|
* @param document filter to remove
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|