ma fuli | 21 Feb 06:56 2012
Picon

how can i insert values into BSONObj and BSONArray?

(1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
how can i add a new key-value into the object obj1, such as how can i
add {serx,male} into the obj1;
(2)i create a new BSONArray
arr=BSON_ARRAY(1<<2<<3<<BSON("name"<<"fuli"));
how to add a new element into the arr array, Thanks a lot.

Nat | 21 Feb 07:01 2012
Picon

Re: how can i insert values into BSONObj and BSONArray?

Check out BSONArrayBuilder and BSONObjBuilder.
-----Original Message-----
From: ma fuli <fulim007@...>
Sender: mongodb-user@...
Date: Mon, 20 Feb 2012 21:56:21 
To: mongodb-user<mongodb-user@...>
Reply-To: mongodb-user@...
Subject: [mongodb-user] how can i insert values into BSONObj and BSONArray?

(1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
how can i add a new key-value into the object obj1, such as how can i
add {serx,male} into the obj1;
(2)i create a new BSONArray
arr=BSON_ARRAY(1<<2<<3<<BSON("name"<<"fuli"));
how to add a new element into the arr array, Thanks a lot.

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

ma fuli | 21 Feb 07:02 2012
Picon

Re: how can i insert values into BSONObj and BSONArray?

can you give me some examples, Thanks

On 2月21日, 下午2时01分, "Nat" <nat.lu...@...> wrote:
> Check out BSONArrayBuilder and BSONObjBuilder.
>
>
>
>
>
>
>
> -----Original Message-----
> From: ma fuli <fulim...@...>
> Sender: mongodb-user@...
> Date: Mon, 20 Feb 2012 21:56:21
> To: mongodb-user<mongodb-user@...>
> Reply-To: mongodb-user@...
> Subject: [mongodb-user] how can i insert values into BSONObj and BSONArray?
>
> (1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
> how can i add a new key-value into the object obj1, such as how can i
> add {serx,male} into the obj1;
> (2)i create a new BSONArray
> arr=BSON_ARRAY(1<<2<<3<<BSON("name"<<"fuli"));
> how to add a new element into the arr array, Thanks a lot.
>
> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@...
> To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
(Continue reading)

ma fuli | 21 Feb 07:03 2012
Picon

Re: how can i insert values into BSONObj and BSONArray?

ps: in C++ language

On 2月21日, 下午1时56分, ma fuli <fulim...@...m> wrote:
> (1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
> how can i add a new key-value into the object obj1, such as how can i
> add {serx,male} into the obj1;
> (2)i create a new BSONArray
> arr=BSON_ARRAY(1<<2<<3<<BSON("name"<<"fuli"));
> how to add a new element into the arr array, Thanks a lot.

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
To unsubscribe from this group, send email to mongodb-user+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Barrie | 21 Feb 20:56 2012

Re: how can i insert values into BSONObj and BSONArray?

Hey Ma,

You should check out the C++ tutorial in the mongodb documentation
here: http://www.mongodb.org/pages/viewpage.action?pageId=133415

Hope this helps.

Barrie

On Feb 21, 1:03 am, ma fuli <fulim...@...> wrote:
> ps: in C++ language
>
> On 2月21日, 下午1时56分, ma fuli <fulim... <at> gmail.com> wrote:
>
>
>
>
>
>
>
> > (1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
> > how can i add a new key-value into the object obj1, such as how can i
> > add {serx,male} into the obj1;
> > (2)i create a new BSONArray
> > arr=BSON_ARRAY(1<<2<<3<<BSON("name"<<"fuli"));
> > how to add a new element into the arr array, Thanks a lot.

--

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongodb-user@...
(Continue reading)

ma fuli | 22 Feb 03:01 2012
Picon

Re: how can i insert values into BSONObj and BSONArray?

Thank you very much ,i have already study the C++ tutorial, and the
the mongodb source code, but i find there are very little introduction
about BSONArray insert operation

On 2月22日, 上午3时56分, Barrie <bar...@...> wrote:
> Hey Ma,
>
> You should check out the C++ tutorial in the mongodb documentation
> here:http://www.mongodb.org/pages/viewpage.action?pageId=133415
>
> Hope this helps.
>
> Barrie
>
> On Feb 21, 1:03 am, mafuli<fulim...@...> wrote:
>
>
>
>
>
>
>
> > ps: in C++ language
>
> > On 2月21日, 下午1时56分, mafuli<fulim... <at> gmail.com> wrote:
>
> > > (1)in the beginning, i create a new BSONObj obj1=BSON("name"<<"fuli");
> > > how can i add a new key-value into the object obj1, such as how can i
> > > add {serx,male} into the obj1;
> > > (2)i create a new BSONArray
(Continue reading)

Nat | 22 Feb 03:05 2012
Picon

Re: how can i insert values into BSONObj and BSONArray?

Take a look at this: 
http://www.mongodb.org/pages/viewpage.action?pageId=19562815


Gmane