TreeFrogFramework  1.18
Public Member Functions | 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)
 
bool update (const QVariantMap &criteria, const QVariantMap &document, bool upsert=false)
 
bool updateById (const QVariantMap &document)
 
bool updateMulti (const QVariantMap &criteria, const QVariantMap &document)
 
bool remove (const QVariantMap &criteria=QVariantMap())
 
bool removeById (const QVariantMap &document)
 
int count (const QVariantMap &criteria=QVariantMap())
 
int numDocsAffected () const
 
QString lastErrorString () const
 
TMongoQueryoperator= (const TMongoQuery &other)
 

Detailed Description

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

Constructor & Destructor Documentation

TMongoQuery::TMongoQuery ( const QString &  collection)

Constructs a TMongoQuery object using the collection collection.

TMongoQuery::TMongoQuery ( const TMongoQuery other)

Copy constructor.

virtual TMongoQuery::~TMongoQuery ( )
inlinevirtual

Member Function Documentation

int TMongoQuery::count ( const QVariantMap &  criteria = QVariantMap())
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()
QVariantMap TMongoQuery::findById ( const QString &  id,
const QStringList &  fields = QStringList() 
)
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.

bool TMongoQuery::insert ( QVariantMap &  document)

Inserts the document document into the collection.

QString TMongoQuery::lastErrorString ( ) const

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

int TMongoQuery::limit ( ) const
inline
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.

int TMongoQuery::numDocsAffected ( ) const

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

int TMongoQuery::offset ( ) const
inline
TMongoQuery & TMongoQuery::operator= ( const TMongoQuery other)

Assignment operator.

bool TMongoQuery::remove ( const QVariantMap &  criteria = QVariantMap())

Removes documents that matches the criteria from the collection.

bool TMongoQuery::removeById ( const QVariantMap &  document)

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

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()
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()
bool 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.

bool TMongoQuery::updateById ( const QVariantMap &  document)

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

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

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

QVariantMap TMongoQuery::value ( ) const

Returns the current document as a QVariantMap object.


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