Re: [mongodb-user] InserBatch and DocumentsAffected

24 views
Skip to first unread message

Robert Stam

unread,
Sep 7, 2012, 10:38:56 AM9/7/12
to mongod...@googlegroups.com
DocumentsAffected is set by the server (it's the "n" field in the response to getLastError), but is only set for Update operations, not for Inserts.

You can assume that if InsertBatch didn't throw an exception that there were no errors (assuming you are using SafeMode.True as you are).

On Fri, Sep 7, 2012 at 4:35 AM, Daniel Moqvist <daniel....@gmail.com> wrote:
Hello,
I'm on C# and running InsertBatch with SafeMode=True.
InsertBatch returns an IEnumerable<SafeModeResult>. When I insert over 25000 documents the IEnumerable only contains 4 elements. All 4 elements has DocumentsAffected = 0.
As I insert over 25000 documents I expected to get over 25000 SafeModeResults in return.
 
How can I confirm that all documents is correctly inserted in the DB?
Is there another way to confirm this? maybe a try/catch to fetch errors?
 
/Daniel

--
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

Reply all
Reply to author
Forward
0 new messages