Bulk save doesn't add keys?

38 views
Skip to first unread message

Steve Anderson

unread,
Jan 24, 2013, 3:01:28 PM1/24/13
to couc...@googlegroups.com
I'm trying to use bulk save, but when I use it, my custom fields on the documents aren't being created.

If I do:

@db.save_doc({'_id' => id,
                   'name' => document_name,
                   :locale => locale,
                   :version => Settings[:version]})

Then each document has a local, name, and version field.  If I change it to

@db.save_doc({'_id' => id,
                   'name' => document_name,
                   :locale => locale,
                   :version => Settings[:version]}, true)

and later, do a 

@db.bulk_save

None of the document have a name, locale, or version string.  The _id is always correct, but the other fields aren't working.  Any ideas?

Jonathan Stott

unread,
Jan 25, 2013, 12:55:12 PM1/25/13
to couc...@googlegroups.com

You probably need to add the :_rev to the bulk update if you're updating documents.

Regards
Jon

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

Steve Anderson

unread,
Feb 5, 2013, 3:25:04 PM2/5/13
to couc...@googlegroups.com
Thanks Jon, and sorry I've taken so long to reply.

That makes sense for an existing document, but what do I do if it's a new document?

     Steve

Jonathan Stott

unread,
Feb 6, 2013, 10:43:01 AM2/6/13
to couc...@googlegroups.com
On 5 February 2013 20:25, Steve Anderson <steve.a...@gmail.com> wrote:
> Thanks Jon, and sorry I've taken so long to reply.
>
> That makes sense for an existing document, but what do I do if it's a new
> document?

If it's new, couchdb should just accept the document and all its keys,
no need for a rev. If it doesn't, I'd suggest looking in the couchdb
logs for errors.

Regards
Jon
Reply all
Reply to author
Forward
0 new messages