@groovy.transform.CompileStatic class MongoExtensions extends java.lang.Object
Extra methods for MongoDB API This extension makes it possible to use Groovy's map syntax instead of having to construct org.bson.Document instances
Constructor and description |
---|
MongoExtensions
() |
Type Params | Return Type | Name and description |
---|---|---|
|
static com.mongodb.client.AggregateIterable<org.bson.Document> |
aggregate(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> pipeline) |
<T> |
static com.mongodb.client.AggregateIterable<T> |
aggregate(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> pipeline, java.lang.Class<T> resultClass) |
<T> |
static T |
asType(org.bson.Document document, java.lang.Class<T> cls) |
<T> |
static T |
asType(com.mongodb.client.FindIterable iterable, java.lang.Class<T> cls) |
|
static long |
count(com.mongodb.client.MongoCollection<org.bson.Document> collection) ********** MongoCollection Extensions ************ |
|
static long |
count(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static long |
count(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, com.mongodb.ReadPreference readPreference) |
|
static long |
count(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map query, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
createAndGetCollection(com.mongodb.client.MongoDatabase db, java.lang.String collectionName, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static void |
createIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> keys, java.lang.String name) |
|
static void |
createIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> keys, java.lang.String name, boolean unique) |
|
static void |
createIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> keys) |
|
static void |
createIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> keys, com.mongodb.client.model.IndexOptions options) |
|
static void |
createIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> keys, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.DeleteResult |
deleteMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static com.mongodb.client.result.DeleteResult |
deleteMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, com.mongodb.WriteConcern writeConcern) |
|
static com.mongodb.client.result.DeleteResult |
deleteMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.DeleteResult |
deleteOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static com.mongodb.client.result.DeleteResult |
deleteOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, com.mongodb.WriteConcern writeConcern) |
|
static com.mongodb.client.result.DeleteResult |
deleteOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.DistinctIterable<org.bson.Document> |
distinct(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String fieldName) |
|
static com.mongodb.client.DistinctIterable<org.bson.Document> |
distinct(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String fieldName, com.mongodb.ReadPreference readPreference) |
|
static com.mongodb.client.DistinctIterable<org.bson.Document> |
distinct(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String fieldName, java.util.Map<java.lang.String, java.lang.Object> query) |
<T> |
static com.mongodb.client.DistinctIterable<T> |
distinct(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String fieldName, java.util.Map<java.lang.String, java.lang.Object> query, java.lang.Class<T> resultClass) |
|
static com.mongodb.client.DistinctIterable<org.bson.Document> |
distinct(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.String fieldName, java.util.Map<java.lang.String, java.lang.Object> query, com.mongodb.ReadPreference readPreference) |
|
static void |
dropIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> index) |
|
static void |
dropIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> index, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static void |
dropIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> index, com.mongodb.client.model.DropIndexOptions dropIndexOptions) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
filter(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> filter) ********** FindIterable Extensions ************ |
|
static com.mongodb.client.DistinctIterable<org.bson.Document> |
filter(com.mongodb.client.DistinctIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> filter) ********** DistinctIterable Extensions ************ |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
find(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
<T> |
static com.mongodb.client.FindIterable<T> |
find(com.mongodb.client.MongoCollection<T> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.lang.Class<T> type) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
find(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> projection) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, org.bson.types.ObjectId id) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.lang.CharSequence id) |
<T> |
static T |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.io.Serializable id, java.lang.Class<T> type) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> projection) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> projection, java.util.Map<java.lang.String, java.lang.Object> sort) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> projection, com.mongodb.ReadPreference readPreference) |
|
static org.bson.Document |
findOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> projection, java.util.Map<java.lang.String, java.lang.Object> sort, com.mongodb.ReadPreference readPreference) |
|
static org.bson.Document |
findOneAndDelete(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter) |
|
static org.bson.Document |
findOneAndDelete(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static org.bson.Document |
findOneAndReplace(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> replacement) |
|
static org.bson.Document |
findOneAndReplace(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> replacement, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static org.bson.Document |
findOneAndUpdate(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update) |
|
static org.bson.Document |
findOneAndUpdate(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static java.lang.Object |
getAt(com.mongodb.client.MongoDatabase db, java.lang.String name) Adds a method to return a collection using the dot syntax |
|
static com.mongodb.client.MongoIterable<java.lang.String> |
getCollectionNames(com.mongodb.client.MongoDatabase db) ********** MongoDatabase Extensions ************ |
|
static long |
getCount(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static long |
getCount(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, com.mongodb.ReadPreference readPreference) |
|
static long |
getCount(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static java.lang.String |
getName(com.mongodb.client.MongoCollection<org.bson.Document> collection) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
hint(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> hint) |
|
static void |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> document) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> document, com.mongodb.WriteConcern writeConcern) |
|
static void |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object>[] documents) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, com.mongodb.WriteConcern writeConcern, java.util.Map<java.lang.String, java.lang.Object>[] documents) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object>[] documents, com.mongodb.WriteConcern writeConcern) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> documents) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> documents, com.mongodb.WriteConcern aWriteConcern) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> documents, com.mongodb.WriteConcern writeConcern, com.mongodb.client.model.InsertManyOptions insertOptions) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
insert(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map> documents, com.mongodb.client.model.InsertManyOptions insertOptions) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
leftShift(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object>[] documents) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
max(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> max) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
min(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> min) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
projection(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> projection) |
|
static java.lang.Object |
propertyMissing(com.mongodb.client.MongoDatabase db, java.lang.String name) Adds a method to return a collection using the dot syntax |
|
static com.mongodb.client.result.DeleteResult |
remove(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static com.mongodb.client.result.UpdateResult |
replaceOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, org.bson.Document replacement) |
|
static com.mongodb.client.result.UpdateResult |
replaceOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, org.bson.Document replacement, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.MongoCollection<org.bson.Document> |
rightShift(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> query) |
|
static com.mongodb.client.MongoCollection |
save(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> document) |
|
static com.mongodb.client.MongoCollection |
save(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> document, com.mongodb.WriteConcern writeConcern) |
|
static com.mongodb.client.FindIterable<org.bson.Document> |
sort(com.mongodb.client.FindIterable<org.bson.Document> iterable, java.util.Map<java.lang.String, java.lang.Object> sort) |
|
private static org.bson.conversions.Bson |
toBson(java.util.Map<java.lang.String, java.lang.Object> map) |
|
private static java.util.List<org.bson.conversions.Bson> |
toBson(java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> list) |
|
static com.mongodb.DBObject |
toDBObject(org.bson.Document document) |
<T> |
static java.util.List<T> |
toList(com.mongodb.client.FindIterable iterable, java.lang.Class<T> cls) |
|
static com.mongodb.client.result.UpdateResult |
update(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update) |
|
static com.mongodb.client.result.UpdateResult |
update(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.UpdateResult |
update(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, com.mongodb.client.model.UpdateOptions updateOptions) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, com.mongodb.client.model.UpdateOptions updateOptions) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.UpdateResult |
updateMany(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update, com.mongodb.client.model.UpdateOptions updateOptions) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.Map<java.lang.String, java.lang.Object> update, com.mongodb.client.model.UpdateOptions updateOptions) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update, java.util.Map<java.lang.String, java.lang.Object> options) |
|
static com.mongodb.client.result.UpdateResult |
updateOne(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.Map<java.lang.String, java.lang.Object> filter, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> update, com.mongodb.client.model.UpdateOptions updateOptions) |
|
static com.mongodb.client.ChangeStreamIterable<org.bson.Document> |
watch(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> pipeline) |
<T> |
static com.mongodb.client.ChangeStreamIterable<T> |
watch(com.mongodb.client.MongoCollection<org.bson.Document> collection, java.util.List<? extends java.util.Map<java.lang.String, java.lang.Object>> pipeline, java.lang.Class<T> resultClass) |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
*********** MongoCollection Extensions ************
*********** FindIterable Extensions ************
*********** DistinctIterable Extensions ************
Adds a method to return a collection using the dot syntax
db
- The database objectname
- The collection name*********** MongoDatabase Extensions ************
Adds a method to return a collection using the dot syntax
db
- The database objectname
- The collection name