Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Mongoid/RubyDriver ContinueOnError not working
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Daniel Schlegel  
View profile  
 More options Aug 2 2012, 8:40 am
From: Daniel Schlegel <firmas...@gmail.com>
Date: Thu, 2 Aug 2012 05:40:57 -0700 (PDT)
Local: Thurs, Aug 2 2012 8:40 am
Subject: Mongoid/RubyDriver ContinueOnError not working

Hi
I try to do inserts in monogo with mongoid. unfortunately<http://www.dict.cc/englisch-deutsch/unfortunately.html> the
continue_on_error option does not work.

Situation:
There is an index on :name

documents = [{:name => "First"}, {:name => "Second"}]

# following line works like expected.
MyCollection.collection.insert(documents, :continue_on_error => true, :safe
=> false)
# => First and Second in DB

documents = [{:name => "First"}, {:name => "Third"}]
MyCollection.collection.insert(documents, :continue_on_error => true, :safe
=> false)
# => Third not in DB.

i don't get an exception while inserting, but it seames, that the batch
stop it's processing when error occured.

Thanks for your help.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Emily S  
View profile  
 More options Aug 2 2012, 12:13 pm
From: Emily S <emily.sto...@10gen.com>
Date: Thu, 2 Aug 2012 09:13:28 -0700 (PDT)
Local: Thurs, Aug 2 2012 12:13 pm
Subject: Re: Mongoid/RubyDriver ContinueOnError not working

Hi

This seems to work for me:

> db['things'].create_index("name", :unique => true)
> documents = [{:name => "First"}, {:name => "Second"}]
> db['things'].insert(documents, :continue_on_error => true, :safe => false)

*in the mongo shell:*
> db.things.find()

{ "_id" : ObjectId("501a9cf13005c82ac9000001"), "name" : "First" }
{ "_id" : ObjectId("501a9cf13005c82ac9000002"), "name" : "Second" }

> documents = [{:name => "First"}, {:name => "Third"}]
> db['things'].insert(documents, :continue_on_error => true, :safe => false)

*in the mongo shell:*
> db.things.find()

{ "_id" : ObjectId("501a9cf13005c82ac9000001"), "name" : "First" }
{ "_id" : ObjectId("501a9cf13005c82ac9000002"), "name" : "Second" }
{ "_id" : ObjectId("501a9d173005c82ac9000004"), "name" : "Third" }

You shouldn't be getting an exception if you use :safe => false
What version of Mongoid are you using?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daniel Schlegel  
View profile  
 More options Aug 2 2012, 2:33 pm
From: Daniel Schlegel <firmas...@gmail.com>
Date: Thu, 2 Aug 2012 11:33:59 -0700 (PDT)
Local: Thurs, Aug 2 2012 2:33 pm
Subject: Re: Mongoid/RubyDriver ContinueOnError not working

Hi Emily
Thank you very much. I tried on a different machine now and there it
worked.
Now i found out, that on the maschine i tried an old mongodb server but new
client was running.

Sorry for wasting your time. this was my fault.

Am Donnerstag, 2. August 2012 18:13:28 UTC+2 schrieb Emily S:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »