Skip to content

Commit

Permalink
In the cursor "next" method, invoke mongotcl_setCursorError on error …
Browse files Browse the repository at this point in the history
…rather than mongotcl_setMongoError. You now get a CURSOR_EXHAUSTED after there are no more rows, although this is clumsy and needs more work.

BUGZID:
  • Loading branch information
lehenbauer committed Feb 13, 2014
1 parent 128d6ec commit e35a5ff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ There's a compile warning on this. It's probably coredump.

Removes a document from a MongoDB server. bson is the bson query.

* $mongo cursor name
* $mongo cursor name namespace

Create a cursor for this MongoDB connection. Name is the name of the object created. If name is #auto, a unique name will be automatically generated and returned.

Expand Down Expand Up @@ -366,5 +366,14 @@ This is a little gross and is going to be simplified, but...
$cursor next
$cursor to_list
```

* Perform a complex query

```tcl
bson create query
query init start_object \$query int age 24 finish_object start_object \$orderby int name 1 finish_object finish
$cursor init $namespace
$cursor set_query $query
```
2 changes: 1 addition & 1 deletion generic/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ mongotcl_cursorObjectObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_

case OPT_CURSOR_NEXT: {
if (mongo_cursor_next (mc->cursor) != MONGO_OK) {
return mongotcl_setMongoError (interp, mc->conn);
return mongotcl_setCursorError (interp, mc->cursor);
}
break;
}
Expand Down

0 comments on commit e35a5ff

Please sign in to comment.