Class Mongo
java.lang.Object
com.github.pinont.singularitylib.api.storage.Mongo
- All Implemented Interfaces:
AutoCloseable
Thin MongoDB client for the Singularity framework (Phase 2).
Configuration section (e.g. from config.yml):
database:
host: localhost
port: 27017
databaseName: minecraft
username: "" # optional
password: "" # optional
Sync operations only; pair with the async Database facade if you
need off-thread execution patterns.
-
Constructor Summary
ConstructorsConstructorDescriptionMongo(org.bukkit.plugin.Plugin plugin, org.bukkit.configuration.ConfigurationSection cfg) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()longCounts matching documents.voidDeletes all documents matching the filter.org.bson.DocumentFinds the first document matching the filter.voidInserts a document.voidUpserts: $set the update fields on the first match, inserting if absent.
-
Constructor Details
-
Mongo
public Mongo(org.bukkit.plugin.Plugin plugin, org.bukkit.configuration.ConfigurationSection cfg)
-
-
Method Details
-
findFirst
Finds the first document matching the filter. -
insert
Inserts a document. -
upsert
Upserts: $set the update fields on the first match, inserting if absent. -
delete
Deletes all documents matching the filter. -
count
Counts matching documents. -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-