|
BSON ObjectID Abstraction SYNOPSIS#include <bson/bson.h>
typedef struct {
DESCRIPTIONThe bson_oid_t structure contains the 12-byte ObjectId notation defined by the BSON ObjectID specification. ObjectId is a 12-byte BSON type, constructed using:
STRING CONVERSIONYou can convert an Object ID to a string using bson_oid_to_string() and back with bson_oid_init_from_string(). HASHINGA bson_oid_t can be used in hashtables using the function bson_oid_hash() and bson_oid_equal(). COMPARINGA bson_oid_t can be compared to another using bson_oid_compare() for qsort() style comparing and bson_oid_equal() for direct equality. VALIDATINGYou can validate that a string containing a hex-encoded ObjectID is valid using the function bson_oid_is_valid(). EXAMPLE#include <bson/bson.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
AUTHORMongoDB, Inc COPYRIGHT2009-present, MongoDB, Inc.
|