rpm  5.4.15
mongo.h
Go to the documentation of this file.
1 #ifndef H_MONGO
2 #define H_MONGO
3 
8 /* Copyright 2009, 2010 10gen Inc.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  */
22 
23 #include <bson.h>
24 
27 typedef /*@refcounted@*/ struct rpmmgo_s * rpmmgo;
28 
31 /*@unchecked@*/
32 extern int _rpmmgo_debug;
33 
34 /*@unchecked@*/ /*@relnull@*/
35 extern rpmmgo _rpmmgoI;
36 
37 /*==============================================================*/
38 /* --- mongo.h */
39 
41 
42 #if !defined(MONGO_ENV_STANDARD) && (defined(__APPLE__) || defined(__linux) || defined(__unix) || defined(__posix))
43  typedef int SOCKET;
44 #else
45  typedef size_t SOCKET; /* Defined socket as size_t to avoid coupling here with Winsock header files. It creates other issues in other files because
46  of redefined types that are used on .c files */
47 #endif
48 
49 #define MONGO_MAJOR 0
50 #define MONGO_MINOR 7
51 #define MONGO_PATCH 0
52 
53 #define MONGO_OK 0
54 #define MONGO_ERROR -1
55 
56 #define MONGO_DEFAULT_PORT 27017
57 
58 #define MONGO_DEFAULT_MAX_BSON_SIZE 4 * 1024 * 1024
59 
60 #define MONGO_ERR_LEN 128
61 
62 #ifndef MAXHOSTNAMELEN
63  #define MAXHOSTNAMELEN 256
64 #endif
65 
66 typedef enum mongo_error_t {
86 
87 typedef enum mongo_cursor_error_t {
96 
100 };
101 
103  MONGO_INDEX_UNIQUE = ( 1<<0 ),
107 };
108 
113 };
114 
117 };
118 
120  MONGO_TAILABLE = ( 1<<1 ),
121  MONGO_SLAVE_OK = ( 1<<2 ),
123  MONGO_AWAIT_DATA = ( 1<<5 ),
124  MONGO_EXHAUST = ( 1<<6 ),
125  MONGO_PARTIAL = ( 1<<7 )
126 };
127 
129  MONGO_OP_MSG = 1000,
136 };
137 
138 #pragma pack(1)
139 typedef struct {
140  int len;
141  int id;
143  int op;
144 } mongo_header;
145 
146 typedef struct {
148  char data;
149 } mongo_message;
150 
151 typedef struct {
152  int flag; /* FIX THIS COMMENT non-zero on failure */
153  int64_t cursorID;
154  int start;
155  int num;
157 
158 typedef struct {
161  char objs;
162 } mongo_reply;
163 #pragma pack()
164 
165 typedef struct mongo_host_port {
167  int port;
170 
171 typedef struct mongo_write_concern {
172  int w;
173  int wtimeout;
174  int j;
175  int fsync;
176  const char *mode;
180 
181 typedef struct {
184  char *name;
187 
188 typedef struct mongo {
192  int flags;
200  int errcode;
204 } mongo;
205 
206 typedef struct {
209  const char *ns;
210  int flags;
211  int seen;
214  const bson *query;
215  const bson *fields;
216  int options;
217  int limit;
218  int skip;
219 } mongo_cursor;
220 
221 /*********************************************************************
222 Connection API
223 **********************************************************************/
224 
227 MONGO_EXPORT void mongo_init_sockets( void );
228 
240 
251 MONGO_EXPORT int mongo_client( mongo *conn , const char *host, int port );
252 
264 MONGO_EXPORT int mongo_connect( mongo *conn , const char *host, int port );
265 
274 
283 MONGO_EXPORT void mongo_replset_init( mongo *conn, const char *name );
284 
294 MONGO_EXPORT void mongo_replica_set_add_seed( mongo *conn, const char *host, int port );
295 
306 MONGO_EXPORT void mongo_replset_add_seed( mongo *conn, const char *host, int port );
307 
315 void mongo_parse_host( const char *host_string, mongo_host_port *host_port );
316 
327 
340 
354 
366 
376 
389 
398 
408 
420 
431 
441 
442 /*********************************************************************
443 CRUD API
444 **********************************************************************/
445 
463 MONGO_EXPORT int mongo_insert( mongo *conn, const char *ns, const bson *data,
465 
487  int flags );
488 
505 MONGO_EXPORT int mongo_update( mongo *conn, const char *ns, const bson *cond,
507 
521 MONGO_EXPORT int mongo_remove( mongo *conn, const char *ns, const bson *cond,
523 
524 
525 /*********************************************************************
526 Write Concern API
527 **********************************************************************/
528 
534 
543 
549 
550 /*********************************************************************
551 Cursor API
552 **********************************************************************/
553 
570  const bson *fields, int limit, int skip, int options );
571 
579 MONGO_EXPORT void mongo_cursor_init( mongo_cursor *cursor, mongo *conn, const char *ns );
580 
593 
603 
611 
619 
628 
635 MONGO_EXPORT const char *mongo_cursor_data( mongo_cursor *cursor );
636 
644 
655 
666 
677 /* out can be NULL if you don't care about results. useful for commands */
678 MONGO_EXPORT int mongo_find_one( mongo *conn, const char *ns, const bson *query,
679  const bson *fields, bson *out );
680 
681 
682 /*********************************************************************
683 Command API and Helpers
684 **********************************************************************/
685 
697 MONGO_EXPORT double mongo_count( mongo *conn, const char *db, const char *coll,
698  const bson *query );
699 
717 MONGO_EXPORT int mongo_create_index( mongo *conn, const char *ns, const bson *key,
718  const char *name, int options, bson *out );
719 
735  const char *field, int options, bson *out );
736 
750  const char *collection, int size, int max, bson *out );
751 
763  const bson *command, bson *out );
764 
778  const char *cmd, int arg, bson *out );
779 
793  const char *cmd, const char *arg, bson *out );
794 
803 MONGO_EXPORT int mongo_cmd_drop_db( mongo *conn, const char *db );
804 
816  const char *collection, bson *out );
817 
829  const char *user, const char *pass );
830 
841 MONGO_EXPORT int mongo_cmd_authenticate( mongo *conn, const char *db,
842  const char *user, const char *pass );
843 
852 /* return value is master status */
854 
868 MONGO_EXPORT int mongo_cmd_get_last_error( mongo *conn, const char *db, bson *out );
869 
883 MONGO_EXPORT int mongo_cmd_get_prev_error( mongo *conn, const char *db, bson *out );
884 
891 MONGO_EXPORT void mongo_cmd_reset_error( mongo *conn, const char *db );
892 
893 
894 /*********************************************************************
895 Utility API
896 **********************************************************************/
897 
913 
923  const char *errstr, int errorcode );
930 
931 /* Close a socket */
933 
935 
936 /*==============================================================*/
937 
938 #if defined(_RPMMGO_INTERNAL)
939 
941 struct rpmmgo_s {
942  struct rpmioItem_s _item;
943  const char * fn;
944 #if defined(__LCLINT__)
945 /*@refs@*/
946  int nrefs;
947 #endif
948 };
949 #endif /* _RPMMGO_INTERNAL */
950 
951 #ifdef __cplusplus
952 extern "C" {
953 #endif
954 
960 /*@unused@*/ /*@null@*/
961 rpmmgo rpmmgoUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmmgo mgo)
962  /*@modifies mgo @*/;
963 #define rpmmgoUnlink(_mgo) \
964  ((rpmmgo)rpmioUnlinkPoolItem((rpmioItem)(_mgo), __FUNCTION__, __FILE__, __LINE__))
965 
971 /*@unused@*/ /*@newref@*/ /*@null@*/
972 rpmmgo rpmmgoLink (/*@null@*/ rpmmgo mgo)
973  /*@modifies mgo @*/;
974 #define rpmmgoLink(_mgo) \
975  ((rpmmgo)rpmioLinkPoolItem((rpmioItem)(_mgo), __FUNCTION__, __FILE__, __LINE__))
976 
982 /*@null@*/
983 rpmmgo rpmmgoFree(/*@killref@*/ /*@null@*/rpmmgo mgo)
984  /*@globals fileSystem @*/
985  /*@modifies mgo, fileSystem @*/;
986 #define rpmmgoFree(_mgo) \
987  ((rpmmgo)rpmioFreePoolItem((rpmioItem)(_mgo), __FUNCTION__, __FILE__, __LINE__))
988 
995 /*@newref@*/ /*@null@*/
996 rpmmgo rpmmgoNew(const char * fn, int flags)
997  /*@globals fileSystem, internalState @*/
998  /*@modifies fileSystem, internalState @*/;
999 
1000 #ifdef __cplusplus
1001 }
1002 #endif
1003 
1004 #endif /* H_MONGO */
int conn_timeout_ms
Connection timeout in milliseconds.
Definition: mongo.h:193
MONGO_EXPORT int mongo_get_err(mongo *conn)
Definition: mongo.c:1779
int w
Number of total replica write copies to complete including the primary.
Definition: mongo.h:172
int options
Bitfield containing cursor options.
Definition: mongo.h:216
mongo_error_t
Definition: mongo.h:66
MONGO_EXPORT void mongo_write_concern_set_wtimeout(mongo_write_concern *write_concern, int wtimeout)
Definition: mongo.c:2878
MONGO_EXPORT void mongo_replica_set_add_seed(mongo *conn, const char *host, int port)
Definition: mongo.c:2244
int id
Definition: mongo.h:141
SOCKET sock
Socket file descriptor.
Definition: mongo.h:191
const char const char * coll
Definition: mongo.h:697
mongo_error_t const char * errstr
Definition: mongo.h:922
An error occurred while reading or writing on the socket.
Definition: mongo.h:75
const bson * query
Bitfield containing cursor options.
Definition: mongo.h:214
int max_bson_size
Largest BSON object allowed on this connection.
Definition: mongo.h:195
const char int port
Definition: mongo.h:251
mongo_cursor_flags
Definition: mongo.h:97
const char const char * cmd
Definition: mongo.h:777
mongo_host_port * seeds
List of seeds provided by the user.
Definition: mongo.h:182
MONGO_EXPORT int mongo_cursor_destroy(mongo_cursor *cursor)
Definition: mongo.c:3158
const char const bson mongo_write_concern * custom_write_concern
Definition: mongo.h:463
MONGO_EXPORT const char * mongo_get_primary(mongo *conn)
Definition: mongo.c:1801
#define MONGO_EXTERN_C_END
Definition: bson.h:51
The command returned with 'ok' value of 0.
Definition: mongo.h:78
#define rpmmgoFree(_mgo)
Definition: mongo.h:986
MONGO_EXPORT bson * mongo_write_concern_get_cmd(mongo_write_concern *write_concern)
Definition: mongo.c:2870
MONGO_EXPORT SOCKET mongo_get_socket(mongo *conn)
Definition: mongo.c:1809
MONGO_EXPORT int mongo_connect(mongo *conn, const char *host, int port)
Definition: mongo.c:2187
const char const bson * cond
Definition: mongo.h:505
MONGO_EXPORT int mongo_remove(mongo *conn, const char *ns, const bson *cond, mongo_write_concern *custom_write_concern)
Definition: mongo.c:2734
MONGO_EXPORT void mongo_cursor_set_fields(mongo_cursor *cursor, const bson *fields)
Definition: mongo.c:3074
struct mongo_write_concern mongo_write_concern
MONGO_EXPORT const char * mongo_get_host(mongo *conn, int i)
Definition: mongo.c:1826
mongo_write_concern * write_concern
Definition: mongo.h:419
MONGO_EXPORT int mongo_check_connection(mongo *conn)
Definition: mongo.c:2451
const char const char * field
Definition: mongo.h:734
MONGO_EXPORT void mongo_cursor_set_limit(mongo_cursor *cursor, int limit)
Definition: mongo.c:3082
const char * ns
owned by cursor
Definition: mongo.h:209
int len
Definition: mongo.h:140
MONGO_EXPORT int mongo_write_concern_get_fsync(mongo_write_concern *write_concern)
Definition: mongo.c:2862
mongo_cursor_error_t
Definition: mongo.h:87
bson * cmd
The BSON object representing the getlasterror command.
Definition: mongo.h:178
BSON object has not been finished.
Definition: mongo.h:82
MONGO_EXPORT void mongo_replset_init(mongo *conn, const char *name)
Definition: mongo.c:2210
char objs
Definition: mongo.h:161
Connection success!
Definition: mongo.h:67
#define MONGO_EXTERN_C_START
Definition: bson.h:50
MONGO_EXPORT int mongo_find_one(mongo *conn, const char *ns, const bson *query, const bson *fields, bson *out)
Definition: mongo.c:3043
Disable cursor timeouts.
Definition: mongo.h:122
MONGO_EXPORT const char * mongo_cursor_data(mongo_cursor *cursor)
Definition: mongo.c:3090
BSON not valid for the specified op.
Definition: mongo.h:81
MONGO_EXPORT int mongo_set_op_timeout(mongo *conn, int millis)
Definition: mongo.c:2428
int op_timeout_ms
Read and write timeout in milliseconds.
Definition: mongo.h:194
int lasterrcode
getlasterror code from the server.
Definition: mongo.h:202
mongo_replica_set * replica_set
replica_set object if connected to a replica set.
Definition: mongo.h:190
const char const char int size
Definition: mongo.h:749
Given rs name doesn't match this replica set.
Definition: mongo.h:72
#define MONGO_EXPORT
Definition: bson.h:42
Allow reads even if a shard is down.
Definition: mongo.h:125
MONGO_EXPORT mongo_write_concern * mongo_write_concern_alloc(void)
Definition: mongo.c:1839
int fsync
Definition: mongo.h:439
int limit
Bitfield containing cursor options.
Definition: mongo.h:217
The server returned an '$err' object, indicating query failure.
Definition: mongo.h:91
mongo_header head
Definition: mongo.h:159
MONGO_EXPORT void mongo_init_sockets(void)
Definition: mongo.c:2156
MONGO_EXPORT void mongo_write_concern_set_w(mongo_write_concern *write_concern, int w)
Definition: mongo.c:2874
mongo_error_t const char int errorcode
Definition: mongo.h:922
mongo * conn
connection is not owned by cursor
Definition: mongo.h:208
mongo_reply_fields fields
Definition: mongo.h:160
char errstr[128]
String version of error.
Definition: mongo.h:201
mongo * conn
Definition: mongo.h:579
int w
Definition: mongo.h:436
const char * mode
Definition: mongo.h:440
MONGO_EXPORT int mongo_get_host_count(mongo *conn)
Definition: mongo.c:1815
MONGO_EXPORT int mongo_cmd_drop_collection(mongo *conn, const char *db, const char *collection, bson *out)
Definition: mongo.c:3372
int millis
Definition: mongo.h:365
MONGO_EXPORT void mongo_disconnect(mongo *conn)
Definition: mongo.c:2458
MONGO_EXPORT void mongo_cmd_reset_error(mongo *conn, const char *db)
Definition: mongo.c:3376
MONGO_EXPORT void mongo_write_concern_init(mongo_write_concern *write_concern)
Definition: mongo.c:2778
MONGO_EXPORT mongo_cursor * mongo_cursor_alloc(void)
Definition: mongo.c:1849
The cursor has timed out or is not recognized.
Definition: mongo.h:89
Tailable cursor still alive but no data.
Definition: mongo.h:90
mongo_error_t err
Definition: mongo.h:922
const char const bson * command
Definition: mongo.h:762
Other socket error.
Definition: mongo.h:76
const char const bson * data
Definition: mongo.h:463
MONGO_EXPORT void mongo_clear_errors(mongo *conn)
Definition: mongo.c:1881
MONGO_EXPORT void mongo_cursor_set_query(mongo_cursor *cursor, const bson *query)
Definition: mongo.c:3070
rpmmgo rpmmgoNew(const char *fn, int flags)
Create and load a mongo wrapper.
Definition: mongo.c:3576
MONGO_EXPORT void mongo_replset_add_seed(mongo *conn, const char *host, int port)
Definition: mongo.c:2248
MONGO_EXPORT void mongo_write_concern_destroy(mongo_write_concern *write_concern)
Free the write_concern object (specifically, the BSON object that it holds).
Definition: mongo.c:2833
const char const bson const bson int limit
Definition: mongo.h:569
int seen
Number returned so far.
Definition: mongo.h:211
The name for the ns (database or collection) is invalid.
Definition: mongo.h:80
MONGO_EXPORT void __mongo_set_error(mongo *conn, mongo_error_t err, const char *str, int errcode)
Definition: mongo.c:1868
int flags
Flags on this connection object.
Definition: mongo.h:192
mongo_host_port * primary
Primary connection info.
Definition: mongo.h:189
int errcode
Most recent errno or WSAGetLastError().
Definition: mongo.h:200
Definition: bson.h:113
MONGO_EXPORT int mongo_write_concern_get_j(mongo_write_concern *write_concern)
Definition: mongo.c:2858
MONGO_EXPORT int mongo_insert_batch(mongo *conn, const char *ns, const bson **bsons, int count, mongo_write_concern *custom_write_concern, int flags)
Definition: mongo.c:2643
mongo_reply * reply
reply is owned by cursor
Definition: mongo.h:207
Allow queries on a non-primary node.
Definition: mongo.h:121
MONGO_EXPORT void mongo_write_concern_set_fsync(mongo_write_concern *write_concern, int fsync)
Definition: mongo.c:2887
MONGO_EXPORT int mongo_cursor_next(mongo_cursor *cursor)
Definition: mongo.c:3098
int _rpmmgo_debug
Definition: mongo.c:42
MONGO_EXPORT int mongo_cmd_get_last_error(mongo *conn, const char *db, bson *out)
Definition: mongo.c:3412
MONGO_EXPORT int mongo_is_connected(mongo *conn)
Definition: mongo.c:1784
mongo_cursor_error_t err
Errors on this cursor.
Definition: mongo.h:213
const char const bson const bson int int skip
Definition: mongo.h:569
const char const bson const bson * fields
Definition: mongo.h:569
const char const char const char * pass
Definition: mongo.h:828
BSON object exceeds max BSON size.
Definition: mongo.h:83
const char const char * user
Definition: mongo.h:828
int mongo_env_close_socket(SOCKET socket)
Definition: mongo.c:1591
MONGO_EXPORT int mongo_insert(mongo *conn, const char *ns, const bson *bson, mongo_write_concern *custom_write_concern)
Definition: mongo.c:2606
Write with given write_concern returned an error.
Definition: mongo.h:79
int i
Definition: mongo.h:906
MONGO_EXPORT int mongo_cmd_get_prev_error(mongo *conn, const char *db, bson *out)
Definition: mongo.c:3408
MONGO_EXPORT int mongo_run_command(mongo *conn, const char *db, const bson *command, bson *out)
Definition: mongo.c:3304
char * name
Name of the replica set.
Definition: mongo.h:184
MONGO_EXPORT int mongo_cmd_drop_db(mongo *conn, const char *db)
Definition: mongo.c:3368
const char const bson const bson * op
Definition: mongo.h:505
const char const char * collection
Definition: mongo.h:749
const char const char int arg
Definition: mongo.h:777
mongo_update_opts
Definition: mongo.h:109
const char * host
Definition: mongo.h:251
MONGO_EXPORT void mongo_init(mongo *conn)
Definition: mongo.c:2167
#define MAXHOSTNAMELEN
Definition: mongo.h:63
BSON Declarations.
MONGO_EXPORT int mongo_simple_str_command(mongo *conn, const char *db, const char *cmdstr, const char *arg, bson *out)
Definition: mongo.c:3352
mongo_index_opts
Definition: mongo.h:102
MONGO_EXPORT int mongo_replica_set_client(mongo *conn)
Definition: mongo.c:2358
char lasterrstr[128]
getlasterror string from the server.
Definition: mongo.h:203
int responseTo
Definition: mongo.h:142
MONGO_EXPORT int mongo_update(mongo *conn, const char *ns, const bson *cond, const bson *op, int flags, mongo_write_concern *custom_write_concern)
Definition: mongo.c:2693
MONGO_EXPORT int mongo_simple_int_command(mongo *conn, const char *db, const char *cmdstr, int arg, bson *out)
Definition: mongo.c:3335
const char const bson int mongo_write_concern int flags
Definition: mongo.h:485
Can't find primary in replica set.
Definition: mongo.h:73
MONGO_EXPORT bson_bool_t mongo_create_simple_index(mongo *conn, const char *ns, const char *field, int options, bson *out)
Definition: mongo.c:3249
MONGO_EXPORT void mongo_write_concern_set_j(mongo_write_concern *write_concern, int j)
Definition: mongo.c:2883
The response is not the expected length.
Definition: mongo.h:77
MONGO_EXPORT void mongo_set_write_concern(mongo *conn, mongo_write_concern *write_concern)
Definition: mongo.c:2844
mongo_header head
Definition: mongo.h:147
Momentarily block for more data.
Definition: mongo.h:123
mongo_host_port * hosts
List of host/ports given by the replica set.
Definition: mongo.h:183
Could not create a socket.
Definition: mongo.h:68
bson_bool_t connected
Connection status.
Definition: mongo.h:196
int wtimeout
Number of milliseconds before replication timeout.
Definition: mongo.h:173
struct mongo mongo
MONGO_EXPORT void mongo_cursor_set_options(mongo_cursor *cursor, int options)
Definition: mongo.c:3086
int skip
Bitfield containing cursor options.
Definition: mongo.h:218
MONGO_EXPORT bson_bool_t mongo_cmd_authenticate(mongo *conn, const char *db, const char *user, const char *pass)
Definition: mongo.c:3491
int wtimeout
Definition: mongo.h:437
int64_t cursorID
Definition: mongo.h:153
int flags
Flags used internally by this drivers.
Definition: mongo.h:210
An error occured while calling getaddrinfo().
Definition: mongo.h:70
Create a tailable cursor.
Definition: mongo.h:120
#define rpmmgoUnlink(_mgo)
Definition: mongo.h:963
MONGO_EXPORT double mongo_count(mongo *conn, const char *db, const char *coll, const bson *query)
Definition: mongo.c:3283
const char const bson * query
Definition: mongo.h:569
MONGO_EXPORT void mongo_replica_set_init(mongo *conn, const char *name)
Definition: mongo.c:2195
const char const bson * key
Definition: mongo.h:717
struct mongo_host_port mongo_host_port
const bson * fields
Bitfield containing cursor options.
Definition: mongo.h:215
const char const bson const bson bson * out
Definition: mongo.h:678
const char const char int int max
Definition: mongo.h:749
mongo_operations
Definition: mongo.h:128
Initial query has been sent.
Definition: mongo.h:99
int j
If non-zero, block until the journal sync.
Definition: mongo.h:174
int bson_bool_t
Definition: bson.h:106
MONGO_EXPORT int mongo_create_capped_collection(mongo *conn, const char *db, const char *collection, int size, int max, bson *out)
Definition: mongo.c:3262
MONGO_EXPORT void mongo_cursor_init(mongo_cursor *cursor, mongo *conn, const char *ns)
Definition: mongo.c:3062
Warning: connected to a non-master node (read-only).
Definition: mongo.h:71
const char * db
Definition: mongo.h:697
char host[256]
Definition: mongo.h:166
mongo_cursor_opts
Definition: mongo.h:119
MONGO_EXPORT const bson * mongo_cursor_bson(mongo_cursor *cursor)
Definition: mongo.c:3094
MONGO_EXPORT const char * mongo_write_concern_get_mode(mongo_write_concern *write_concern)
Definition: mongo.c:2866
MONGO_EXPORT void mongo_cursor_set_skip(mongo_cursor *cursor, int skip)
Definition: mongo.c:3078
#define rpmmgoLink(_mgo)
Definition: mongo.h:974
MONGO_EXPORT int mongo_validate_ns(mongo *conn, const char *ns)
Definition: mongo.c:1906
MONGO_EXPORT void mongo_write_concern_dealloc(mongo_write_concern *write_concern)
Definition: mongo.c:1844
void mongo_parse_host(const char *host_string, mongo_host_port *host_port)
Utility function for converting a host-port string to a mongo_host_port.
Definition: mongo.c:2253
MONGO_EXPORT void mongo_destroy(mongo *conn)
Definition: mongo.c:2474
int op
Definition: mongo.h:143
struct mongo_host_port * next
Definition: mongo.h:168
bson_bool_t primary_connected
Primary node connection status.
Definition: mongo.h:185
MONGO_EXPORT int mongo_write_concern_get_w(mongo_write_concern *write_concern)
Definition: mongo.c:2850
MONGO_EXPORT void mongo_cursor_dealloc(mongo_cursor *cursor)
Definition: mongo.c:1854
MONGO_EXPORT int mongo_replset_connect(mongo *conn)
Definition: mongo.c:2420
const char * mode
Either "majority" or a getlasterrormode.
Definition: mongo.h:176
Definition: mongo.h:188
bson current
This cursor's current bson object.
Definition: mongo.h:212
MONGO_EXPORT int mongo_cmd_add_user(mongo *conn, const char *db, const char *user, const char *pass)
Definition: mongo.c:3456
mongo_error_t err
Most recent driver error code.
Definition: mongo.h:199
MONGO_EXPORT void mongo_write_concern_set_mode(mongo_write_concern *write_concern, const char *mode)
Definition: mongo.c:2892
size_t SOCKET
Definition: mongo.h:45
An error occured while calling connect().
Definition: mongo.h:69
MONGO_EXPORT int mongo_client(mongo *conn, const char *host, int port)
Definition: mongo.c:2173
Stream in multiple 'more' packages.
Definition: mongo.h:124
struct rpmmgo_s * rpmmgo
Definition: mongo.h:27
MONGO_EXPORT int mongo_write_concern_get_wtimeout(mongo_write_concern *write_concern)
Definition: mongo.c:2854
const char const bson const bson int int int options
Definition: mongo.h:569
#define MONGO_ERR_LEN
Definition: mongo.h:60
MONGO_EXPORT int mongo_get_server_err(mongo *conn)
Definition: mongo.c:1859
rpmmgo _rpmmgoI
Definition: mongo.c:45
The cursor has no more results.
Definition: mongo.h:88
MONGO_EXPORT int mongo_create_index(mongo *conn, const char *ns, const bson *key, const char *name, int options, bson *out)
Definition: mongo.c:3197
MONGO_EXPORT int mongo_reconnect(mongo *conn)
Definition: mongo.c:2436
Supplied write concern object is invalid.
Definition: mongo.h:84
MONGO_EXPORT int mongo_get_op_timeout(mongo *conn)
Definition: mongo.c:1789
mongo_cursor_destroy should free cursor.
Definition: mongo.h:98
int fsync
Same a j with journaling enabled; otherwise, call fsync.
Definition: mongo.h:175
MONGO_EXPORT const char * mongo_get_server_err_string(mongo *conn)
Definition: mongo.c:1864
const char * name
Definition: mongo.h:273
char data
Definition: mongo.h:148
MONGO_EXPORT bson_bool_t mongo_cmd_ismaster(mongo *conn, bson *realout)
Definition: mongo.c:3416
int j
Definition: mongo.h:438
const char const bson int num
Definition: mongo.h:485
mongo_write_concern * write_concern
The default write concern.
Definition: mongo.h:197
MONGO_EXPORT mongo * mongo_alloc(void)
Definition: mongo.c:1770
MONGO_EXPORT void mongo_dealloc(mongo *conn)
Definition: mongo.c:1775
const char * ns
Definition: mongo.h:326
MONGO_EXPORT mongo_cursor * mongo_find(mongo *conn, const char *ns, const bson *query, const bson *fields, int limit, int skip, int options)
Definition: mongo.c:3022
MONGO_EXPORT int mongo_write_concern_finish(mongo_write_concern *write_concern)
Definition: mongo.c:2782
Something is wrong with the BSON provided.
Definition: mongo.h:93
mongo_insert_opts
Definition: mongo.h:115