Couchbase Lite
Objective-C API for iOS and Mac OS
Instance Methods | Properties | List of all members
CBLQueryRow Class Reference

A result row from a CouchbaseLite view query. More...

#import <CBLQuery.h>

Inheritance diagram for CBLQueryRow:
CBLFullTextQueryRow CBLGeoQueryRow

Instance Methods

(id) - keyAtIndex:
 If this row's key is an array, returns the item at that index in the array. More...
 

Properties

id key
 The row's key: this is the first parameter passed to the emit() call that generated the row. More...
 
id value
 The row's value: this is the second parameter passed to the emit() call that generated the row. More...
 
NSString * documentID
 The ID of the document described by this view row. More...
 
NSString * sourceDocumentID
 The ID of the document that caused this view row to be emitted. More...
 
NSString * documentRevisionID
 The revision ID of the document this row was mapped from. More...
 
CBLDatabasedatabase
 
CBLDocumentdocument
 The document this row was mapped from. More...
 
NSDictionary * documentProperties
 The properties of the document this row was mapped from. More...
 
id key0
 Convenience for use in keypaths. More...
 
id key1
 
id key2
 
id key3
 
UInt64 sequenceNumber
 The database sequence number of the associated doc/revision. More...
 
NSArray * conflictingRevisions
 Returns all conflicting revisions of the document, as an array of CBLRevision, or nil if the document is not in conflict. More...
 

Detailed Description

A result row from a CouchbaseLite view query.

Full-text and geo queries return subclasses – see CBLFullTextQueryRow and CBLGeoQueryRow.

Method Documentation

- (id) keyAtIndex: (NSUInteger)  index

If this row's key is an array, returns the item at that index in the array.

If the key is not an array, index=0 will return the key itself. If the index is out of range, returns nil.

Property Documentation

- (id) key
readatomicassign

The row's key: this is the first parameter passed to the emit() call that generated the row.

- (id) value
readatomicassign

The row's value: this is the second parameter passed to the emit() call that generated the row.

- (NSString*) documentID
readatomicassign

The ID of the document described by this view row.

This is not necessarily the same as the document that caused this row to be emitted; see the discussion of the .sourceDocumentID property for details.

- (NSString*) sourceDocumentID
readatomicassign

The ID of the document that caused this view row to be emitted.

This is the value of the "id" property of the JSON view row. It will be the same as the .documentID property, unless the map function caused a related document to be linked by adding an "_id" key to the emitted value; in this case .documentID will refer to the linked document, while sourceDocumentID always refers to the original document. In a reduced or grouped query the value will be nil, since the rows don't correspond to individual documents.

- (NSString*) documentRevisionID
readatomicassign

The revision ID of the document this row was mapped from.

- (CBLDatabase*) database
readatomicassign
- (CBLDocument*) document
readatomicassign

The document this row was mapped from.

This will be nil if a grouping was enabled in the query, because then the result rows don't correspond to individual documents.

- (NSDictionary*) documentProperties
readatomicassign

The properties of the document this row was mapped from.

To get this, you must have set the .prefetch property on the query; else this will be nil. (You can still get the document properties via the .document property, of course. But it takes a separate call to the database. So if you're doing it for every row, using .prefetch and .documentProperties is faster.)

- (id) key0
readatomicassign

Convenience for use in keypaths.

Returns the key at the given index.

- (id) key1
readatomicassign
- (id) key2
readatomicassign
- (id) key3
readatomicassign
- (UInt64) sequenceNumber
readatomicassign

The database sequence number of the associated doc/revision.

- (NSArray*) conflictingRevisions
readatomicassign

Returns all conflicting revisions of the document, as an array of CBLRevision, or nil if the document is not in conflict.

The first object in the array will be the default "winning" revision that shadows the others. This is only valid in an allDocuments query whose allDocsMode is set to kCBLShowConflicts or kCBLOnlyConflicts; otherwise it returns nil.


The documentation for this class was generated from the following file: