why c++ driver insert function has no feedback?

130 views
Skip to first unread message

li ning

unread,
May 20, 2013, 11:45:23 AM5/20/13
to mongod...@googlegroups.com
When insert a doc which the _id already exist in db, how should I know it? In the shell there is a error output said duplicate key. What about c++ driver's insert? 
and the insert function has thrid parameter: int flag=0. What is this used for? The api reference is very simple, I can not find any description more, sorry

Xinjun Li

unread,
May 21, 2013, 10:27:11 PM5/21/13
to mongod...@googlegroups.com
The MongoDB INSERT message has no response at all, you can check the wire protocol here http://docs.mongodb.org/meta-driver/latest/legacy/mongodb-wire-protocol/.

If you want to check whether there's a  error occurred, you need to call get_last_error. 

You can check the source codes of each driver to see how it encapsulated in that driver. 


On Mon, May 20, 2013 at 11:45 PM, li ning <li.ni...@gmail.com> wrote:
When insert a doc which the _id already exist in db, how should I know it? In the shell there is a error output said duplicate key. What about c++ driver's insert? 
and the insert function has thrid parameter: int flag=0. What is this used for? The api reference is very simple, I can not find any description more, sorry

--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb
 
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Rock Li

Skype: insfocus
Mobile: 186 0001 4356 

Felipe Albrecht

unread,
Jun 8, 2013, 12:53:57 PM6/8/13
to mongod...@googlegroups.com
Is it not a design flaw?
Because to check if the insertion had error will be necessary another network request to mongodb...


2013/5/22 Xinjun Li <ro...@appannie.com>
Reply all
Reply to author
Forward
0 new messages