热卖商品
新闻详情
BSON C 学习笔记_pk124729136的专栏-CSDN博客
来自 : CSDN技术社区
发布时间:2021-03-26
一、数组里面添加元素
#include bson.h
#include bcon.h
bson_t *Array;
bson_t *doc;
Array bson_new();
doc bson_new();
BSON_APPEND_UTF8(Array, 0 , utf8
BSON_APPEND_INT32(Array, 1 , 32);
BSON_APPEND_DOUBLE(Array, 2 , 20.2);
BSON_APPEND_ARRAY(doc, array , Array);
这样就完成了在一个文档中的数组中添加元素 上述代码中的“0” “1” “2”
为在数组的下标参数。
二、数组里面嵌套文档
bson_t *tmp;
tmp bson_new();
BSON_APPEND_UTF8(tmp, UTF8 , utf8
BSON_APPEND_DOCUMENT(Array, 0 , tmp)
BSON_APPEND_ARRAY(doc, array , Array);
点赞 评论2014年11月27日一、数组里面添加元素 #include #include bson_t *Array; bson_t *doc; Array = bson_new(); doc = bson_new(); BSON_APPEND_UTF8(Array, "0", "...BSON C 学习笔记一、数组里面添加元素 #include #include bson_t *Array; bson_t *doc; Array = bson_new(); doc = bson_new(); BSON_APPEND_UTF8(Array, "0", "utf8");BSON C 学习笔记
本文链接: http://cambsonc.immuno-online.com/view-781523.html
发布于 : 2021-03-26
阅读(0)
最新动态
2021-03-26
2021-03-26
2021-03-26
2021-03-26
2021-03-26