Example #1
0
    std::vector<EnsureIndexInfo> MongoClient::getIndexes(const MongoCollectionInfo &collection) const
    {
        std::vector<EnsureIndexInfo> result;
        std::auto_ptr<mongo::DBClientCursor> cursor(_dbclient->getIndexes(collection.ns().toString()));

        while (cursor->more()) {
            mongo::BSONObj bsonObj = cursor->next();
            result.push_back(makeEnsureIndexInfoFromBsonObj(collection,bsonObj));
        }

        return result;
    }
Example #2
0
    std::vector<EnsureIndexInfo> MongoClient::getIndexes(const MongoCollectionInfo &collection) const
    {
        std::vector<EnsureIndexInfo> result;
        std::list<mongo::BSONObj> indexes = _dbclient->getIndexSpecs(collection.ns().toString());

//        std::unique_ptr<mongo::DBClientCursor> cursor(_dbclient->getIndexSpecs(collection.ns().toString()));

        for (std::list<mongo::BSONObj>::iterator it = indexes.begin(); it != indexes.end(); ++it) {
            mongo::BSONObj bsonObj = *it;
            result.push_back(makeEnsureIndexInfoFromBsonObj(collection, bsonObj));
        }

        return result;
    }
Example #3
0
    std::vector<EnsureIndexInfo> MongoClient::getIndexes(const MongoCollectionInfo &collection) const
    {
        std::vector<EnsureIndexInfo> result;
        std::string indexNamespace = mongo::Namespace(collection.ns().toString()).getSisterNS("system.indexes");
        std::auto_ptr<mongo::DBClientCursor> cursor(_dbclient->
            query( indexNamespace.c_str(), BSON("ns" << collection.ns().toString()), 0, 0, 0, mongo::QueryOption_SlaveOk, 0)
        );

        while (cursor->more()) {
            mongo::BSONObj bsonObj = cursor->next();
            result.push_back(makeEnsureIndexInfoFromBsonObj(collection,bsonObj));
        }

        return result;
    }