/*
 * This source code file was generated by the C-code generator gentclAPI.tcl,
 * part of the Next Scripting Framework.
 */

#if defined(USE_NSF_STUBS)
int Nsf_ConvertTo_Boolean(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToBoolean(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Class(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToClass(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Int32(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToInt32(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Integer(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToInteger(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Object(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToObject(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Pointer(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToPointer(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_String(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToString(interp, objPtr, pPtr, clientData, outObjPtr);
}
int Nsf_ConvertTo_Tclobj(Tcl_Interp *interp, Tcl_Obj *objPtr,  Nsf_Param const *pPtr,
			  ClientData *clientData, Tcl_Obj **outObjPtr) {
  return Nsf_ConvertToTclobj(interp, objPtr, pPtr, clientData, outObjPtr);
}
#else
# define Nsf_ConvertTo_Boolean Nsf_ConvertToBoolean
# define Nsf_ConvertTo_Class Nsf_ConvertToClass
# define Nsf_ConvertTo_Int32 Nsf_ConvertToInt32
# define Nsf_ConvertTo_Integer Nsf_ConvertToInteger
# define Nsf_ConvertTo_Object Nsf_ConvertToObject
# define Nsf_ConvertTo_Pointer Nsf_ConvertToPointer
# define Nsf_ConvertTo_String Nsf_ConvertToString
# define Nsf_ConvertTo_Tclobj Nsf_ConvertToTclobj
#endif


#if !defined(likely)
# if defined(__GNUC__) && __GNUC__ > 2
/* Use gcc branch prediction hint to minimize cost of e.g. DTrace
 * ENABLED checks.
 */
#  define unlikely(x) (__builtin_expect((x), 0))
#  define likely(x) (__builtin_expect((x), 1))
# else
#  define unlikely(x) (x)
#  define likely(x) (x)
# endif
#endif



typedef enum {GridfilesourceNULL, GridfilesourceFileIdx, GridfilesourceStringIdx} GridfilesourceIdx_t;

static int ConvertToGridfilesource(Tcl_Interp *interp, Tcl_Obj *objPtr, Nsf_Param const *pPtr,
			    ClientData *clientData, Tcl_Obj **outObjPtr) {
  int pos, result;
  static const char *opts[] = {"file", "string", NULL};
  (void)pPtr;
  result = Tcl_GetIndexFromObj(interp, objPtr, opts, "gridfilesource", 0, &pos);
  *clientData = (ClientData) INT2PTR(pos + 1);
  *outObjPtr = objPtr;
  return result;
}
  

      static Nsf_EnumeratorConverterEntry enumeratorConverterEntries[] = {
  {ConvertToGridfilesource, "file|string"},
  {NULL, NULL}
};
    

/* just to define the symbol */
static Nsf_methodDefinition method_definitions[31];
  
static const char *method_command_namespace_names[] = {
  "::mongo"
};
static int NsfCollectionCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfCollectionOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionCountStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionDeleteStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionIndexStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionInsertStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionQueryStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionStatsStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCollectionUpdateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoConnectStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCursorAggregateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCursorCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCursorFindStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoCursorNextStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFSCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFSOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileCreateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileDeleteStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileGetContentTypeStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileGetContentlengthStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileGetMetaDataStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileReadStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoGridFileSeekStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoJsonGenerateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoJsonParseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoRunCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);
static int NsfMongoStatusStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv)
  NSF_nonnull(2) NSF_nonnull(4);

static int NsfCollectionClose(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *collectionObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfCollectionOpen(Tcl_Interp *interp, mongoc_client_t *connPtr, const char *dbname, const char *collectionname)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4);
static int NsfMongoClose(Tcl_Interp *interp, mongoc_client_t *connPtr, Tcl_Obj *connObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoCollectionCount(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *queryObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCollectionDelete(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *conditionObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCollectionIndex(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *attributesObj, const char *withName, int withBackground, int withDropdups, int withSparse, int withTtl, int withUnique)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCollectionInsert(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *valuesObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCollectionQuery(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *filterObj, Tcl_Obj *optsObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCollectionStats(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *optionsObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoCollectionUpdate(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *condObj, Tcl_Obj *valuesObj, int withUpsert, int withAll)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4);
static int NsfMongoConnect(Tcl_Interp *interp, const char *withUri)
  NSF_nonnull(1);
static int NsfMongoCursorAggregate(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *pipelineObj, Tcl_Obj *optionsObj, int withTailable, int withAwaitdata)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4);
static int NsfMongoCursorClose(Tcl_Interp *interp, mongoc_cursor_t *cursorPtr, Tcl_Obj *cursorObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoCursorFind(Tcl_Interp *interp, mongoc_collection_t *collectionPtr, Tcl_Obj *filterObj, Tcl_Obj *optsObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoCursorNext(Tcl_Interp *interp, mongoc_cursor_t *cursorPtr)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFSClose(Tcl_Interp *interp, mongoc_gridfs_t *gfsPtr, Tcl_Obj *gfsObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFSOpen(Tcl_Interp *interp, mongoc_client_t *connPtr, const char *dbname, const char *prefix)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3) NSF_nonnull(4);
static int NsfMongoGridFileClose(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr, Tcl_Obj *gridfileObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFileCreate(Tcl_Interp *interp, GridfilesourceIdx_t withSource, mongoc_gridfs_t *gfsPtr, const char *value, const char *name, const char *contenttype, Tcl_Obj *metadataObj)
  NSF_nonnull(1) NSF_nonnull(3) NSF_nonnull(4) NSF_nonnull(5) NSF_nonnull(6);
static int NsfMongoGridFileDelete(Tcl_Interp *interp, mongoc_gridfs_t *gfsPtr, Tcl_Obj *queryObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoGridFileGetContentType(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFileGetContentlength(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFileGetMetaData(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFileOpen(Tcl_Interp *interp, mongoc_gridfs_t *gfsPtr, Tcl_Obj *queryObj)
  NSF_nonnull(1) NSF_nonnull(2) NSF_nonnull(3);
static int NsfMongoGridFileRead(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr, int size)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoGridFileSeek(Tcl_Interp *interp, mongoc_gridfs_file_t *gridfilePtr, int offset)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoJsonGenerate(Tcl_Interp *interp, Tcl_Obj *listObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoJsonParse(Tcl_Interp *interp, Tcl_Obj *jsonObj)
  NSF_nonnull(1) NSF_nonnull(2);
static int NsfMongoRunCmd(Tcl_Interp *interp, int withNocomplain, mongoc_client_t *connPtr, const char *db, Tcl_Obj *cmdObj)
  NSF_nonnull(1) NSF_nonnull(3) NSF_nonnull(4) NSF_nonnull(5);
static int NsfMongoStatus(Tcl_Interp *interp, mongoc_client_t *connPtr, Tcl_Obj *connObj)
  NSF_nonnull(1) NSF_nonnull(2);

enum {
 NsfCollectionCloseIdx,
 NsfCollectionOpenIdx,
 NsfMongoCloseIdx,
 NsfMongoCollectionCountIdx,
 NsfMongoCollectionDeleteIdx,
 NsfMongoCollectionIndexIdx,
 NsfMongoCollectionInsertIdx,
 NsfMongoCollectionQueryIdx,
 NsfMongoCollectionStatsIdx,
 NsfMongoCollectionUpdateIdx,
 NsfMongoConnectIdx,
 NsfMongoCursorAggregateIdx,
 NsfMongoCursorCloseIdx,
 NsfMongoCursorFindIdx,
 NsfMongoCursorNextIdx,
 NsfMongoGridFSCloseIdx,
 NsfMongoGridFSOpenIdx,
 NsfMongoGridFileCloseIdx,
 NsfMongoGridFileCreateIdx,
 NsfMongoGridFileDeleteIdx,
 NsfMongoGridFileGetContentTypeIdx,
 NsfMongoGridFileGetContentlengthIdx,
 NsfMongoGridFileGetMetaDataIdx,
 NsfMongoGridFileOpenIdx,
 NsfMongoGridFileReadIdx,
 NsfMongoGridFileSeekIdx,
 NsfMongoJsonGenerateIdx,
 NsfMongoJsonParseIdx,
 NsfMongoRunCmdIdx,
 NsfMongoStatusIdx
} NsfMethods;


static int
NsfCollectionCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfCollectionCloseIdx].paramDefs,
                     method_definitions[NsfCollectionCloseIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfCollectionClose(interp, collectionPtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfCollectionOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfCollectionOpenIdx].paramDefs,
                     method_definitions[NsfCollectionOpenIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_client_t *connPtr = (mongoc_client_t *)pc.clientData[0];
    const char *dbname = (const char *)pc.clientData[1];
    const char *collectionname = (const char *)pc.clientData[2];

    assert(pc.status == 0);
    return NsfCollectionOpen(interp, connPtr, dbname, collectionname);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCloseIdx].paramDefs,
                     method_definitions[NsfMongoCloseIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_client_t *connPtr = (mongoc_client_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoClose(interp, connPtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionCountStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionCountIdx].paramDefs,
                     method_definitions[NsfMongoCollectionCountIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *queryObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoCollectionCount(interp, collectionPtr, queryObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionDeleteStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionDeleteIdx].paramDefs,
                     method_definitions[NsfMongoCollectionDeleteIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *conditionObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoCollectionDelete(interp, collectionPtr, conditionObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionIndexStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionIndexIdx].paramDefs,
                     method_definitions[NsfMongoCollectionIndexIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *attributesObj = (Tcl_Obj *)pc.clientData[1];
    const char *withName = (const char *)pc.clientData[2];
    int withBackground = (int )PTR2INT(pc.clientData[3]);
    int withDropdups = (int )PTR2INT(pc.clientData[4]);
    int withSparse = (int )PTR2INT(pc.clientData[5]);
    int withTtl = (int )PTR2INT(pc.clientData[6]);
    int withUnique = (int )PTR2INT(pc.clientData[7]);

    assert(pc.status == 0);
    return NsfMongoCollectionIndex(interp, collectionPtr, attributesObj, withName, withBackground, withDropdups, withSparse, withTtl, withUnique);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionInsertStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionInsertIdx].paramDefs,
                     method_definitions[NsfMongoCollectionInsertIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *valuesObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoCollectionInsert(interp, collectionPtr, valuesObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionQueryStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionQueryIdx].paramDefs,
                     method_definitions[NsfMongoCollectionQueryIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *filterObj = (Tcl_Obj *)pc.clientData[1];
    Tcl_Obj *optsObj = (Tcl_Obj *)pc.clientData[2];

    assert(pc.status == 0);
    return NsfMongoCollectionQuery(interp, collectionPtr, filterObj, optsObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionStatsStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionStatsIdx].paramDefs,
                     method_definitions[NsfMongoCollectionStatsIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *optionsObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoCollectionStats(interp, collectionPtr, optionsObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCollectionUpdateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCollectionUpdateIdx].paramDefs,
                     method_definitions[NsfMongoCollectionUpdateIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *condObj = (Tcl_Obj *)pc.clientData[1];
    Tcl_Obj *valuesObj = (Tcl_Obj *)pc.clientData[2];
    int withUpsert = (int )PTR2INT(pc.clientData[3]);
    int withAll = (int )PTR2INT(pc.clientData[4]);

    assert(pc.status == 0);
    return NsfMongoCollectionUpdate(interp, collectionPtr, condObj, valuesObj, withUpsert, withAll);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoConnectStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoConnectIdx].paramDefs,
                     method_definitions[NsfMongoConnectIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    const char *withUri = (const char *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoConnect(interp, withUri);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCursorAggregateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCursorAggregateIdx].paramDefs,
                     method_definitions[NsfMongoCursorAggregateIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *pipelineObj = (Tcl_Obj *)pc.clientData[1];
    Tcl_Obj *optionsObj = (Tcl_Obj *)pc.clientData[2];
    int withTailable = (int )PTR2INT(pc.clientData[3]);
    int withAwaitdata = (int )PTR2INT(pc.clientData[4]);

    assert(pc.status == 0);
    return NsfMongoCursorAggregate(interp, collectionPtr, pipelineObj, optionsObj, withTailable, withAwaitdata);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCursorCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCursorCloseIdx].paramDefs,
                     method_definitions[NsfMongoCursorCloseIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_cursor_t *cursorPtr = (mongoc_cursor_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoCursorClose(interp, cursorPtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCursorFindStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCursorFindIdx].paramDefs,
                     method_definitions[NsfMongoCursorFindIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_collection_t *collectionPtr = (mongoc_collection_t *)pc.clientData[0];
    Tcl_Obj *filterObj = (Tcl_Obj *)pc.clientData[1];
    Tcl_Obj *optsObj = (Tcl_Obj *)pc.clientData[2];

    assert(pc.status == 0);
    return NsfMongoCursorFind(interp, collectionPtr, filterObj, optsObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoCursorNextStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoCursorNextIdx].paramDefs,
                     method_definitions[NsfMongoCursorNextIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_cursor_t *cursorPtr = (mongoc_cursor_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoCursorNext(interp, cursorPtr);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFSCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFSCloseIdx].paramDefs,
                     method_definitions[NsfMongoGridFSCloseIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_t *gfsPtr = (mongoc_gridfs_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoGridFSClose(interp, gfsPtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFSOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFSOpenIdx].paramDefs,
                     method_definitions[NsfMongoGridFSOpenIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_client_t *connPtr = (mongoc_client_t *)pc.clientData[0];
    const char *dbname = (const char *)pc.clientData[1];
    const char *prefix = (const char *)pc.clientData[2];

    assert(pc.status == 0);
    return NsfMongoGridFSOpen(interp, connPtr, dbname, prefix);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileCloseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileCloseIdx].paramDefs,
                     method_definitions[NsfMongoGridFileCloseIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoGridFileClose(interp, gridfilePtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileCreateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileCreateIdx].paramDefs,
                     method_definitions[NsfMongoGridFileCreateIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    GridfilesourceIdx_t withSource = (GridfilesourceIdx_t )pc.clientData[0];
    mongoc_gridfs_t *gfsPtr = (mongoc_gridfs_t *)pc.clientData[1];
    const char *value = (const char *)pc.clientData[2];
    const char *name = (const char *)pc.clientData[3];
    const char *contenttype = (const char *)pc.clientData[4];
    Tcl_Obj *metadataObj = (Tcl_Obj *)pc.clientData[5];

    assert(pc.status == 0);
    return NsfMongoGridFileCreate(interp, withSource, gfsPtr, value, name, contenttype, metadataObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileDeleteStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileDeleteIdx].paramDefs,
                     method_definitions[NsfMongoGridFileDeleteIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_t *gfsPtr = (mongoc_gridfs_t *)pc.clientData[0];
    Tcl_Obj *queryObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoGridFileDelete(interp, gfsPtr, queryObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileGetContentTypeStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileGetContentTypeIdx].paramDefs,
                     method_definitions[NsfMongoGridFileGetContentTypeIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoGridFileGetContentType(interp, gridfilePtr);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileGetContentlengthStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileGetContentlengthIdx].paramDefs,
                     method_definitions[NsfMongoGridFileGetContentlengthIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoGridFileGetContentlength(interp, gridfilePtr);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileGetMetaDataStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileGetMetaDataIdx].paramDefs,
                     method_definitions[NsfMongoGridFileGetMetaDataIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoGridFileGetMetaData(interp, gridfilePtr);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileOpenStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileOpenIdx].paramDefs,
                     method_definitions[NsfMongoGridFileOpenIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_t *gfsPtr = (mongoc_gridfs_t *)pc.clientData[0];
    Tcl_Obj *queryObj = (Tcl_Obj *)pc.clientData[1];

    assert(pc.status == 0);
    return NsfMongoGridFileOpen(interp, gfsPtr, queryObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileReadStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileReadIdx].paramDefs,
                     method_definitions[NsfMongoGridFileReadIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];
    int size = (int )PTR2INT(pc.clientData[1]);

    assert(pc.status == 0);
    return NsfMongoGridFileRead(interp, gridfilePtr, size);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoGridFileSeekStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoGridFileSeekIdx].paramDefs,
                     method_definitions[NsfMongoGridFileSeekIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_gridfs_file_t *gridfilePtr = (mongoc_gridfs_file_t *)pc.clientData[0];
    int offset = (int )PTR2INT(pc.clientData[1]);

    assert(pc.status == 0);
    return NsfMongoGridFileSeek(interp, gridfilePtr, offset);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoJsonGenerateStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  (void)clientData;

    

      if (objc != 2) {
	return NsfArgumentError(interp, "wrong # of arguments:",
			     method_definitions[NsfMongoJsonGenerateIdx].paramDefs,
			     NULL, objv[0]);
      }
    
    return NsfMongoJsonGenerate(interp, objv[1]);

}

static int
NsfMongoJsonParseStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  (void)clientData;

    

      if (objc != 2) {
	return NsfArgumentError(interp, "wrong # of arguments:",
			     method_definitions[NsfMongoJsonParseIdx].paramDefs,
			     NULL, objv[0]);
      }
    
    return NsfMongoJsonParse(interp, objv[1]);

}

static int
NsfMongoRunCmdStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoRunCmdIdx].paramDefs,
                     method_definitions[NsfMongoRunCmdIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    int withNocomplain = (int )PTR2INT(pc.clientData[0]);
    mongoc_client_t *connPtr = (mongoc_client_t *)pc.clientData[1];
    const char *db = (const char *)pc.clientData[2];
    Tcl_Obj *cmdObj = (Tcl_Obj *)pc.clientData[3];

    assert(pc.status == 0);
    return NsfMongoRunCmd(interp, withNocomplain, connPtr, db, cmdObj);

  } else {
    
    return TCL_ERROR;
  }
}

static int
NsfMongoStatusStub(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const* objv) {
  ParseContext pc;
  (void)clientData;

  if (likely(ArgumentParse(interp, objc, objv, NULL, objv[0],
                     method_definitions[NsfMongoStatusIdx].paramDefs,
                     method_definitions[NsfMongoStatusIdx].nrParameters, 0, NSF_ARGPARSE_BUILTIN,
                     &pc) == TCL_OK)) {
    mongoc_client_t *connPtr = (mongoc_client_t *)pc.clientData[0];

    assert(pc.status == 0);
    return NsfMongoStatus(interp, connPtr,pc.objv[0]);

  } else {
    
    return TCL_ERROR;
  }
}

static Nsf_methodDefinition method_definitions[31] = {
{"::mongo::collection::close", NsfCollectionCloseStub, 1, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::open", NsfCollectionOpenStub, 3, {
  {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_client_t",NULL,NULL,NULL,NULL,NULL},
  {"dbname", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"collectionname", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::close", NsfMongoCloseStub, 1, {
  {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_client_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::count", NsfMongoCollectionCountStub, 2, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::delete", NsfMongoCollectionDeleteStub, 2, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"condition", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::index", NsfMongoCollectionIndexStub, 8, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"attributes", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-name", 0, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-background", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-dropdups", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-sparse", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-ttl", 0, 1, Nsf_ConvertTo_Int32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL},
  {"-unique", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::insert", NsfMongoCollectionInsertStub, 2, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::query", NsfMongoCollectionQueryStub, 3, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-opts", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::stats", NsfMongoCollectionStatsStub, 2, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"-options", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::collection::update", NsfMongoCollectionUpdateStub, 5, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"cond", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"values", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-upsert", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-all", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::connect", NsfMongoConnectStub, 1, {
  {"-uri", 0, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::cursor::aggregate", NsfMongoCursorAggregateStub, 5, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"pipeline", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"options", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-tailable", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-awaitdata", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::cursor::close", NsfMongoCursorCloseStub, 1, {
  {"cursor", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_cursor_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::cursor::find", NsfMongoCursorFindStub, 3, {
  {"collection", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_collection_t",NULL,NULL,NULL,NULL,NULL},
  {"filter", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-opts", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::cursor::next", NsfMongoCursorNextStub, 1, {
  {"cursor", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_cursor_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfs::close", NsfMongoGridFSCloseStub, 1, {
  {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfs::open", NsfMongoGridFSOpenStub, 3, {
  {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_client_t",NULL,NULL,NULL,NULL,NULL},
  {"dbname", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"prefix", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::close", NsfMongoGridFileCloseStub, 1, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::create", NsfMongoGridFileCreateStub, 6, {
  {"-source", NSF_ARG_REQUIRED|NSF_ARG_IS_ENUMERATION, 1, ConvertToGridfilesource, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_t",NULL,NULL,NULL,NULL,NULL},
  {"value", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"name", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"contenttype", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"-metadata", 0, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::delete", NsfMongoGridFileDeleteStub, 2, {
  {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_t",NULL,NULL,NULL,NULL,NULL},
  {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::get_contenttype", NsfMongoGridFileGetContentTypeStub, 1, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::get_contentlength", NsfMongoGridFileGetContentlengthStub, 1, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::get_metadata", NsfMongoGridFileGetMetaDataStub, 1, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::open", NsfMongoGridFileOpenStub, 2, {
  {"gfs", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_t",NULL,NULL,NULL,NULL,NULL},
  {"query", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::read", NsfMongoGridFileReadStub, 2, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL},
  {"size", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Int32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::gridfile::seek", NsfMongoGridFileSeekStub, 2, {
  {"gridfile", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_gridfs_file_t",NULL,NULL,NULL,NULL,NULL},
  {"offset", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Int32, NULL,NULL,"int32",NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::json::generate", NsfMongoJsonGenerateStub, 1, {
  {"list", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::json::parse", NsfMongoJsonParseStub, 1, {
  {"json", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::run", NsfMongoRunCmdStub, 4, {
  {"-nocomplain", 0, 0, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_client_t",NULL,NULL,NULL,NULL,NULL},
  {"db", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_String, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL},
  {"cmd", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Tclobj, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}
},
{"::mongo::status", NsfMongoStatusStub, 1, {
  {"conn", NSF_ARG_REQUIRED, 1, Nsf_ConvertTo_Pointer, NULL,NULL,"mongoc_client_t",NULL,NULL,NULL,NULL,NULL}}
},
{NULL, NULL, 0, {{NULL, 0, 0, NULL, NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL}}}
};