0

I've created my mongodb query like this >

 86     bson query[1];
 87     bson_init(query);
 88     bson_append_start_object(query, "service.virtual_mach    ine");
 89         bson_append_oid(query,"_id",result);
 90     bson_append_finish_object(query);
 91     bson_finish(query);

and i run it using this>

 93     bson fields[1];
 94     bson_init(fields);
 95     bson_append_oid(fields, "_id", result);
 96     bson_finish(fields);
 97 
 98     mongo_cursor* cursor = NULL;
 99     cursor = mongo_find(conn, "db.services", query, field    s, 9999,0,0);

and if i print the "mongo_cursor_next(cursor)" method i got a "-1" (ERROR), i want to know, what's the error in my query.

Thank you in advance.

guisantogui
  • 4,017
  • 9
  • 49
  • 93

1 Answers1

0

This one? https://github.com/mongodb/mongo-c-driver#error-handling

Most functions return MONGO_OK or BSON_OK on success and MONGO_ERROR or BSON_ERROR on failure. Specific error codes and error strings are then stored in the err and errstr fields of the mongo and bson objects. It is the client's responsibility to check for errors and handle them appropriately.

thejh
  • 44,854
  • 16
  • 96
  • 107
  • Sorry, i think that i'd not expressed in a good way. My problem is that my query doesn't returns nothing, when must return all records to that oid, and i don't know where are the problem, if is in the query, in parameters, or the select that was created wrong. – guisantogui Jun 04 '12 at 13:07