TreeFrogFramework  1.29
Public Member Functions | Friends | List of all members
TMongoQuery Class Reference

#include <tmongoquery.h>

Inheritance diagram for TMongoQuery:
Inheritance graph
[legend]

Public Member Functions

 TMongoQuery (const QString &collection)
 
 TMongoQuery (const TMongoQuery &other)
 
virtual ~TMongoQuery ()
 
int limit () const
 
void setLimit (int limit)
 
int offset () const
 
void setOffset (int offset)
 
bool find (const QVariantMap &criteria=QVariantMap(), const QVariantMap &orderBy=QVariantMap(), const QStringList &fields=QStringList())
 
bool next ()
 
QVariantMap value () const
 
QVariantMap findOne (const QVariantMap &criteria=QVariantMap(), const QStringList &fields=QStringList())
 
QVariantMap findById (const QString &id, const QStringList &fields=QStringList())
 
bool insert (QVariantMap &document)
 
int update (const QVariantMap &criteria, const QVariantMap &document, bool upsert=false)
 
bool updateById (const QVariantMap &document)
 
int updateMulti (const QVariantMap &criteria, const QVariantMap &document)
 
int remove (const QVariantMap &criteria)
 
bool removeById (const QVariantMap &document)
 
int count (const QVariantMap &criteria=QVariantMap())
 
QString lastErrorString () const
 
TMongoQueryoperator= (const TMongoQuery &other)
 

Friends

class TCacheMongoStore
 

Detailed Description

The TMongoQuery class provides a means of operating a MongoDB system.

Constructor & Destructor Documentation

◆ TMongoQuery() [1/2]

TMongoQuery::TMongoQuery ( const QString &  collection)

Constructs a TMongoQuery object using the collection collection.

◆ TMongoQuery() [2/2]

TMongoQuery::TMongoQuery ( const TMongoQuery other)

Copy constructor.

◆ ~TMongoQuery()

virtual TMongoQuery::~TMongoQuery ( )
inlinevirtual

Member Function Documentation

◆ count()

int TMongoQuery::count ( const QVariantMap &  criteria = QVariantMap())

◆ find()

bool TMongoQuery::find ( const QVariantMap &  criteria = QVariantMap(),
const QVariantMap &  orderBy = QVariantMap(),
const QStringList &  fields = QStringList() 
)

Finds documents by the criteria criteria in the collection and returns the number of the documents.

Use the fields parameter to control the fields to return.

See also
TMongoQuery::next()

◆ findById()

QVariantMap TMongoQuery::findById ( const QString &  id,
const QStringList &  fields = QStringList() 
)

◆ findOne()

QVariantMap TMongoQuery::findOne ( const QVariantMap &  criteria = QVariantMap(),
const QStringList &  fields = QStringList() 
)

Finds documents by the criteria criteria in the collection and returns a retrieved document as a QVariantMap object.

Use the fields parameter to control the fields to return.

◆ insert()

bool TMongoQuery::insert ( QVariantMap &  document)

Inserts the document document into the collection.

◆ lastErrorString()

QString TMongoQuery::lastErrorString ( ) const

Returns the number of documents affected by the result's Mongo statement, or -1 if it cannot be determined.

Returns the string of the most recent error with the current connection.

◆ limit()

int TMongoQuery::limit ( ) const
inline

◆ next()

bool TMongoQuery::next ( )

Retrieves the next document in the result set, if available, and positions on the retrieved document.

Returns true if the record is successfully retrieved; otherwise returns false.

◆ offset()

int TMongoQuery::offset ( ) const
inline

◆ operator=()

TMongoQuery & TMongoQuery::operator= ( const TMongoQuery other)

Assignment operator.

◆ remove()

int TMongoQuery::remove ( const QVariantMap &  criteria)

Removes documents that matches the criteria from the collection.

◆ removeById()

bool TMongoQuery::removeById ( const QVariantMap &  document)

Removes an existing document that matches the ObjectID of the document from the collection.

◆ setLimit()

void TMongoQuery::setLimit ( int  limit)
inline

Sets the limit to limit, which is the limited number of documents for finding documents.

See also
TMongoQuery::find()

◆ setOffset()

void TMongoQuery::setOffset ( int  offset)
inline

Sets the offset to offset, which is the number of documents to skip for finding documents.

See also
TMongoQuery::find()

◆ update()

int TMongoQuery::update ( const QVariantMap &  criteria,
const QVariantMap &  document,
bool  upsert = false 
)

Updates an existing document of the selection criteria criteria in the collection with new document document.

When the upsert is true, inserts the document in the collection if no document matches the criteria.

◆ updateById()

bool TMongoQuery::updateById ( const QVariantMap &  document)

Updates an existing document that matches the ObjectID with the document.

◆ updateMulti()

int TMongoQuery::updateMulti ( const QVariantMap &  criteria,
const QVariantMap &  document 
)

Updates existing documents of the selection criteria criteria in the collection with new document document.

◆ value()

QVariantMap TMongoQuery::value ( ) const

Returns the current document as a QVariantMap object.

Friends And Related Function Documentation

◆ TCacheMongoStore

friend class TCacheMongoStore
friend

The documentation for this class was generated from the following files: