DBCollectionFree class abstract
An abstract class representing a MongoDB collection with utility methods.
The DBCollection
class provides an abstraction over a MongoDB collection,
offering various methods to interact with the database, such as checking for
the existence of a document by its ID, updating fields, and more. This class
is meant to be extended by other classes for more specific collection implementations.
Constructors
- DBCollectionFree({required String name, required Db db, required DBFormFree form})
-
Constructor to initialize the
name
of the collection and thedb
instance.
Properties
- collection → DbCollection
-
Provides direct access to the underlying MongoDB collection.
no setter
- db ↔ Db
-
The MongoDB database instance.
getter/setter pair
- form ↔ DBFormFree
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- name ↔ String
-
The name of the MongoDB collection.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
copy(
String id) → Future< void> - Creates a copy of a document by its ID and inserts it as a new document.
-
delete(
String id) → Future< bool> - Deletes a document from the collection by its ID.
-
existId(
String idField) → Future< bool> - Checks if a document with the given ID exists in the collection.
-
getAll(
{SelectorBuilder? selector, Map< String, Object?> ? filter, FindOptions? findOptions, String? hint, int? skip, Map<String, Object> ? sort, int? limit, Map<String, Object> ? hintDocument, Map<String, Object> ? projection, Map<String, Object> ? rawOptions}) → Future<List< Map< >String, Object?> > -
getById(
String id) → Future< Map< String, Object?> ?> -
getCount(
{String? field, Object? value, Map< String, Object?> ? filter}) → Future<int> -
getSearchableFilter(
{required Map< String, Object?> inputs, String searchFiled = 'search'}) → Map<String, Object?> -
insert(
Map< String, Object?> data) → Future<FormResultFree> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
replaceOne(
String id, Map< String, Object?> data) → Future<FormResultFree?> -
toFormResult(
Map< String, Object?> document) → FormResultFree -
toModel(
Map< String, Object?> document, {List<String> ? selectedFields}) → Map<String, Object?> -
toString(
) → String -
A string representation of this object.
inherited
-
updateField(
String id, String field, Object? value) → Future< FormResultFree?> - Updates a specific field of a document by its ID.
-
validate(
Map< String, Object?> data) → FormResultFree
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited