Struct ledb::Collection

source ·
pub struct Collection(_);
Expand description

Collection of documents

Implementations§

Insert document into collection

The primary key/identifier of document will be selected by auto incrementing the id of last inserted document.

Primary key/identifier of new inserted document will be returned.

Find documents using optional filter and ordering

When none filter specified then all documents will be found.

Iterator across found documents will be returned.

You can use DocumentsIterator::len() for getting the total number of found documents.

Find documents using optional filter and ordering

When none filter specified then all documents will be found.

The vector with found documents will be returned.

Update documents using optional filter and modifier

Note: When none filter specified then all documents will be modified.

Returns the number of affected documents.

Remove documents using optional filter

Note: When none filter specified then all documents will be removed.

Returns the number of affected documents.

Dump all documents which stored into the collection

Load new documents into the collection

Note: The old documents will be removed.

Remove all documents from the collection

Checks the collection contains document with specified primary key

Get document from collection using primary key/identifier

Replace document in the collection

Note: The document must have primary key/identifier.

Delete document with specified primary key/identifier from the collection

Get the last primary key/identifier of inserted document

Get the new primary key/identifier

Get indexes info from the collection

Set indexes of collection

This method overrides collection indexes

Set indexes using document type

This method overrides collection indexes

Ensure index for the collection

Checks the index for specified field exists for the collection

Create index for the collection

Remove index from the collection

Methods from Deref<Target = Database<'static>>§

Returns a reference to the Environment to which this Database belongs.

This can be used to elide needing to pass both an &Environment and an &Database around, but is also useful for the use-case wherein the Database owns the Environment.

Because this may borrow an Environment owned by this Database, the lifetime of the returned reference is dependent on self rather than being 'env. (In fact, 'env is usually 'static if the Environment is owned by the Database, so returning &'env Environment is impossible anyway.)

Example
let env: lmdb::Environment = create_env();
// We only want one `Database`, so don't bother keeping both variables
// around and instead let the `Database` own the `Environment`.
let db = lmdb::Database::open(
  env, None, &lmdb::DatabaseOptions::defaults()).unwrap();

// `env` has been consumed, but we can still do useful things by
// getting a reference to the inner value.
let txn = lmdb::ReadTransaction::new(db.env()).unwrap();

// Do stuff with `txn`, etc.

Checks that other_env is the same as the environment on this Database.

If it matches, returns Ok(()); otherwise, returns Err.

👎Deprecated since 0.4.4: use as_raw() instead

Returns the underlying integer handle for this database.

Deprecated

Renamed to as_raw() for consistency.

Returns the underlying integer handle for this database.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
The type this value dereferences to.
Returns the (constant) value that this value dereferences to.
The resulting type after dereferencing.
Dereferences the value.
Executes the destructor for this type. Read more
Converts this type into the (usually inferred) input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more
Returns the address of self. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Clone this value, and then immediately put it into a Box behind a trait object of this trait. Read more
Returns the address of self. Read more
Given ptr, which was obtained from a prior call to Self::borrow(), return a value with the same nominal lifetime which is guaranteed to survive mutations to Self. Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.