16
16
* You should have received a copy of the GNU Affero General Public License
17
17
* along with this program. If not, see <http://www.gnu.org/licenses/>.
19
* As a special exception, the copyright holders give permission to link the
20
* code of portions of this program with the OpenSSL library under certain
21
* conditions as described in each individual source file and distribute
22
* linked combinations including the program with the OpenSSL library. You
23
* must comply with the GNU Affero General Public License in all respects
24
* for all of the code used other than as permitted herein. If you modify
25
* file(s) with this exception, you may extend this exception to your
26
* version of the file(s), but you are not obligated to do so. If you do not
27
* wish to do so, delete this exception statement from your version. If you
28
* delete this exception statement from all source files in the program,
29
* then also delete it in the license file.
22
#include "../db/instance.h"
23
#include "../db/json.h"
24
#include "../db/lasterror.h"
25
#include "../util/timer.h"
32
#include "mongo/pch.h"
34
#include "mongo/db/db.h"
35
#include "mongo/db/instance.h"
36
#include "mongo/db/json.h"
37
#include "mongo/db/lasterror.h"
38
#include "mongo/dbtests/dbtests.h"
39
#include "mongo/util/timer.h"
28
41
namespace DirectClientTests {
103
116
virtual void run(){
104
117
auto_ptr<DBClientCursor> cursor = client().query( "", Query(), 1 );
118
ASSERT(cursor->more());
105
119
BSONObj result = cursor->next().getOwned();
106
120
ASSERT( result.hasField( "$err" ));
121
ASSERT_EQUALS(result["code"].Int(), 16332);
110
125
class BadNSGetMore : ClientBase {
112
127
virtual void run(){
113
ASSERT( !client().getMore( "", 1, 1 )->more() );
128
auto_ptr<DBClientCursor> cursor = client().getMore("", 1, 1);
129
ASSERT(cursor->more());
130
BSONObj result = cursor->next().getOwned();
131
ASSERT(result.hasField("$err"));
132
ASSERT_EQUALS(result["code"].Int(), 16258);