首页 > 代码库 > MongoDB C driver API continues

MongoDB C driver API continues

开篇前

<1,mongoc_init() func>

mongoc_init()

Synopsis

voidmongoc_init (void);

Description

This function should be called at the beginning of every program using the MongoDB C driver. It is responsible for initializing global state such as process counters, SSL, and threading primatives.

When your process has completed, you should also call mongoc_clearup()

<2,mongoc_cleanup() func>

mongoc_cleanup()

Synopsis

voidmongoc_cleanup (void);

Description

This function is responsible for cleaning up after use of the MongoDB C driver. It will release any lingering allocated memory which can be useful when running under valgrind.

1,insert document

part statement codeExample:

runing Example:

2,update document

3,finding a document

跟进specifying a query

find a specifyc document maching {"Hello":"world"}

db.users.stats()

4,Execing a command

MongoDB C driver API continues