Get all revisions of a document with CouchbaseLite

29 views
Skip to first unread message

Victor Fernandez

unread,
Apr 22, 2015, 1:20:28 PM4/22/15
to mobile-c...@googlegroups.com
Hi
I'm working with CouchbaseLite Native for Objective-c. I need to get an specific document with all the revisions of this one, with map funcion views I'm getting only the last one.
Does anyone know a way to get all the revisions? 

Regards!

Jens Alfke

unread,
Apr 22, 2015, 1:52:24 PM4/22/15
to mobile-c...@googlegroups.com

On Apr 22, 2015, at 10:20 AM, Victor Fernandez <vfern...@txmglobal.com> wrote:

I'm working with CouchbaseLite Native for Objective-c. I need to get an specific document with all the revisions of this one, with map funcion views I'm getting only the last one.
Does anyone know a way to get all the revisions? 

-[CBLDocument getRevisionHistory:]

Just keep in mind that the only revision that’s guaranteed to still contain data is the current one*; compaction will remove the properties of outdated revisions.

—Jens

* or ‘current ones’ if there are conflicts

Victor Fernandez

unread,
Apr 22, 2015, 1:55:25 PM4/22/15
to mobile-c...@googlegroups.com
Hi Jens, thanks a lot for your answer.
What do you means when you said Current ones? Is it possible to have two documents with the same ID? 

Jens Alfke

unread,
Apr 22, 2015, 2:01:10 PM4/22/15
to mobile-c...@googlegroups.com

On Apr 22, 2015, at 10:55 AM, Victor Fernandez <vfern...@txmglobal.com> wrote:

What do you means when you said Current ones?

If there are conflicts, each conflicting revision is a leaf in the revision tree and is considered current, so it won’t be compacted away.

 Is it possible to have two documents with the same ID? 

No; the document ID is its unique identifier in the database.

—Jens

Sandra

unread,
Apr 22, 2015, 2:14:10 PM4/22/15
to mobile-c...@googlegroups.com
Hello Jens,
   We are interested in knowing if there are different versions of the same document, because we want to do some actions in case of conflict.
   How can we retrieve all current revisions of a document using map functions?
BR, Sandra

Jens Alfke

unread,
Apr 22, 2015, 2:51:42 PM4/22/15
to mobile-c...@googlegroups.com

On Apr 22, 2015, at 11:14 AM, Sandra <txm...@gmail.com> wrote:

   We are interested in knowing if there are different versions of the same document, because we want to do some actions in case of conflict.
   How can we retrieve all current revisions of a document using map functions?

It’s in the docs. See the code snippets.

—Jens

Jens Alfke

unread,
Apr 22, 2015, 2:53:00 PM4/22/15
to mobile-c...@googlegroups.com

On Apr 22, 2015, at 11:51 AM, Jens Alfke <je...@mooseyard.com> wrote:

It’s in the docs. See the code snippets.

Oops, that section shows how to resolve conflicts, not how to find them. Try this section instead.

—Jens

Sandra

unread,
Apr 22, 2015, 5:34:17 PM4/22/15
to mobile-c...@googlegroups.com
Excellent!! Let us give it a try!
Thank you,
Sandra
Reply all
Reply to author
Forward
0 new messages