Continue on error in batch

61 views
Skip to first unread message

Chandra Sekar S

unread,
Mar 26, 2014, 9:40:37 PM3/26/14
to mgo-...@googlegroups.com
How can I ask mongo to continue inserting remaining documents in a batch even if some of them cause a duplicate key when using mgo?

Chandra Sekar S

unread,
Apr 10, 2014, 10:40:09 AM4/10/14
to mgo-...@googlegroups.com
From the source, it appears that mgo doesn't send any flags with insert and neither provides any way to set it in the API.

Are there plans to support this, possibly in a new method?

--
Chandra Sekar.S

Gustavo Niemeyer

unread,
Apr 10, 2014, 3:32:00 PM4/10/14
to mgo-...@googlegroups.com

Hi Chandra,

Indeed it doesn't allow setting individual flags, as that would prevent the driver from implementing the same semantics in different ways, but I'm happy to add support for any flags you need via a proper API.

So you want to insert documents in bulk mode without stopping on errors, right? I'll see how to integrate that nicely in a way that fits with the new 2.6 command mechanism.

gustavo @ http://niemeyer.net

--
You received this message because you are subscribed to the Google Groups "mgo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mgo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chandra Sekar S

unread,
May 13, 2014, 6:54:26 AM5/13/14
to mgo-...@googlegroups.com
Should I create an issue to track this somewhere?

Gustavo Niemeyer

unread,
May 13, 2014, 9:03:28 AM5/13/14
to mgo-...@googlegroups.com
Hi Chandra,

If you prefer, feel free to create a ticket in Launchpad or MongoDB's Jira.

Sorry this is taking a while. The activities of April have put me off
development for a little while, but I'm coming back now.
> --
> You received this message because you are subscribed to the Google Groups
> "mgo-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mgo-users+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--

gustavo @ http://niemeyer.net

Gustavo Niemeyer

unread,
Jun 20, 2014, 2:16:43 PM6/20/14
to mgo-...@googlegroups.com, Chandra Sekar S
Alright, I have a good plan for how to merge your needs with the API
changes that were introduced in 2.6.

Do you have a moment to have a look and test this new API within your
application?

Gustavo Niemeyer

unread,
Jun 20, 2014, 11:21:22 PM6/20/14
to Chandra Sekar S, mgo-...@googlegroups.com


Okay, the new API was pushed, although it's not yet released. If you manually update your branch, you'll see a new Bulk method on Collection. This enables the functionality you want (via the Unordered method) and is also the beginnings of the 2.6+ Bulk API support.

Please let me know if you find a moment to test it. This will be in the upcoming release.

gustavo @ http://niemeyer.net

Gustavo Niemeyer

unread,
Jun 21, 2014, 4:19:32 AM6/21/14
to Chandru, mgo-...@googlegroups.com
Yeah, "go get -u" won't work until the release is tagged, and that's
not done until it's announced.

You can move the branch up to tip by running "bzr pull" within the
respective directory. If you'd rather wait, that's okay too. It won't
take long until this is out.

On Sat, Jun 21, 2014 at 2:33 AM, Chandru <chand...@gmail.com> wrote:
> I could not see the method after go get -u labix.org/v2/mgo
>
> I'm not familiar with bzr. How do I go about testing this?
>
> --
> Chandra Sekar.S
>
>
> On Sat, Jun 21, 2014 at 8:51 AM, Gustavo Niemeyer <gus...@niemeyer.net>
Reply all
Reply to author
Forward
0 new messages