{"_id":"5529b2a9d739240d00a34847","createdAt":"2015-04-07T02:52:50.481Z","user":"55233ae0dbe3622300a3251d","githubsync":"","hidden":false,"type":"basic","__v":0,"link_external":false,"link_url":"","sync_unique":"","title":"Persistence","updates":[],"category":"5529b2a8d739240d00a34844","project":"55233b29e2de0a3500f0a2f8","api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]},"auth":"required","params":[],"url":""},"order":2,"body":"Ohmoc uses [rlite](https://github.com/seppo0010/rlite) for query and storage. rlite implements a redis-compatible API as a library.



Internally, the database persists as a single file. To ensure integrity a second file (write-ahead log) is written before writing, but deleted after. If the process crashes during the operation and the wal file was fully written, the operation will be applied the next time the database is used. If it failed while writing the wal, it will be discarded.



Every time a write operation returns, the changes are already fsync'd to the file system, meaning the database is [ACID](https://en.wikipedia.org/wiki/ACID).



Before using Ohmoc, an instance has to be created. If no [path](/docs/ohmoc#-id-initwithpathnsstring_path) is specified, it will not persist and will only used memory.","excerpt":"","slug":"persistence","version":"5529b2a8d739240d00a34843","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} Persistence Ohmoc uses [rlite](https://github.com/seppo0010/rlite) for query and storage. rlite implements a redis-compatible API as a library. Internally, the database persists as a single file. To ensure integrity a second file (write-ahead log) is written before writing, but deleted after. If the process crashes during the operation and the wal file was fully written, the operation will be applied the next time the database is used. If it failed while writing the wal, it will be discarded. Every time a write operation returns, the changes are already fsync'd to the file system, meaning the database is [ACID](https://en.wikipedia.org/wiki/ACID). Before using Ohmoc, an instance has to be created. If no [path](/docs/ohmoc#-id-initwithpathnsstring_path) is specified, it will not persist and will only used memory. Edit this Page Suggest Edits Ohmoc uses [rlite](https://github.com/seppo0010/rlite) for query and storage. rlite implements a redis-compatible API as a library. Internally, the database persists as a single file. To ensure integrity a second file (write-ahead log) is written before writing, but deleted after. If the process crashes during the operation and the wal file was fully written, the operation will be applied the next time the database is used. If it failed while writing the wal, it will be discarded. Every time a write operation returns, the changes are already fsync'd to the file system, meaning the database is [ACID](https://en.wikipedia.org/wiki/ACID). Before using Ohmoc, an instance has to be created. If no [path](/docs/ohmoc#-id-initwithpathnsstring_path) is specified, it will not persist and will only used memory.

{"_id":"5529b2a9d739240d00a34848","category":"5529b2a8d739240d00a34844","createdAt":"2015-04-07T02:55:03.590Z","githubsync":"","hidden":false,"title":"Multi threading","excerpt":"","user":"55233ae0dbe3622300a3251d","updates":[],"link_external":false,"link_url":"","__v":0,"project":"55233b29e2de0a3500f0a2f8","sync_unique":"","body":"Ohmoc is not multithread safe. An Ohmoc instance must always be used from within the same thread, or with locks around it to prevent race conditions.



However there are alternatives you can use. Since the file is locked when a thread is actively reading from it, having two Ohmoc instances sharing the file path is safe.



Alternatively, you can use a task queue and callbacks. Luckily, [OhmocAsync](doc:ohmocasync) provides this functionality out of the box.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"Allow Duplicates\"

}

[/block]

When an Ohmoc object is created, it can decide to `allowDuplicates` or not.



When the flag is off, the instance is statically stored and Ohmoc will return this instance when the class method `instance` is called from the same thread. Attempting to create a second Ohmoc from the same thread using `allowDuplicates` will throw an exception.



When the flag is on, the instance is not registered and just returned.



The nice part of having this flag disabled is to get a nicer syntax when querying for objects. [OOCModel](doc:oocmodel) provides shortcuts that use this global variable to simplify the code.","slug":"multi-threading","version":"5529b2a8d739240d00a34843","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"order":3,"type":"basic","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} Multi threading Ohmoc is not multithread safe. An Ohmoc instance must always be used from within the same thread, or with locks around it to prevent race conditions. However there are alternatives you can use. Since the file is locked when a thread is actively reading from it, having two Ohmoc instances sharing the file path is safe. Alternatively, you can use a task queue and callbacks. Luckily, [OhmocAsync](doc:ohmocasync) provides this functionality out of the box. [block:api-header] { "type": "basic", "title": "Allow Duplicates" } [/block] When an Ohmoc object is created, it can decide to `allowDuplicates` or not. When the flag is off, the instance is statically stored and Ohmoc will return this instance when the class method `instance` is called from the same thread. Attempting to create a second Ohmoc from the same thread using `allowDuplicates` will throw an exception. When the flag is on, the instance is not registered and just returned. The nice part of having this flag disabled is to get a nicer syntax when querying for objects. [OOCModel](doc:oocmodel) provides shortcuts that use this global variable to simplify the code. Edit this Page Suggest Edits Ohmoc is not multithread safe. An Ohmoc instance must always be used from within the same thread, or with locks around it to prevent race conditions. However there are alternatives you can use. Since the file is locked when a thread is actively reading from it, having two Ohmoc instances sharing the file path is safe. Alternatively, you can use a task queue and callbacks. Luckily, [OhmocAsync](doc:ohmocasync) provides this functionality out of the box. [block:api-header] { "type": "basic", "title": "Allow Duplicates" } [/block] When an Ohmoc object is created, it can decide to `allowDuplicates` or not. When the flag is off, the instance is statically stored and Ohmoc will return this instance when the class method `instance` is called from the same thread. Attempting to create a second Ohmoc from the same thread using `allowDuplicates` will throw an exception. When the flag is on, the instance is not registered and just returned. The nice part of having this flag disabled is to get a nicer syntax when querying for objects. [OOCModel](doc:oocmodel) provides shortcuts that use this global variable to simplify the code.

{"_id":"5529b2a9d739240d00a3484a","__v":0,"project":"55233b29e2de0a3500f0a2f8","user":"55233ae0dbe3622300a3251d","createdAt":"2015-04-07T02:59:00.618Z","link_url":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"type":"basic","version":"5529b2a8d739240d00a34843","hidden":false,"excerpt":"","slug":"ohmoc","title":"Ohmoc","githubsync":"","updates":[],"link_external":false,"sync_unique":"","order":0,"body":"[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (id) create\"

}

[/block]

Creates and initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (id) createWithPath:(NSString*)path\"

}

[/block]

Creates and initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (id) createWithDocumentFilename:(NSString*)filename\"

}

[/block]

Creates and initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) init\"

}

[/block]

Initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) initAllowDuplicates:(BOOL)allowDuplicates\"

}

[/block]

Initializes an Ohmoc instance using a memory only storage and [optionally registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) initWithPath:(NSString*)path\"

}

[/block]

Initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) initWithPath:(NSString*)path allowDuplicates:(BOOL)allowDuplicates\"

}

[/block]

Initializes an Ohmoc instance using a file located at path and [optionally registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) initWithDocumentFilename:(NSString*)filename\"

}

[/block]

Initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) initWithDocumentFilename:(NSString*)filename allowDuplicates:(BOOL)allowDuplicates\"

}

[/block]

Initializes an Ohmoc instance using a file name filename in the documents directory and [optionally registers the database globally](/docs/multi-threading#allow-duplicates).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) find:(NSDictionary*)dict model:(Class)modelClass\"

}

[/block]

Finds all objects of class `Class` that match the filters in `dict`.



`Class` must be a subclass of OOCModel.



In `dict`, the keys must have an [index](/docs/declaring-models#oocindex). If the value of the object is an enumerable, it will return objects that match all of the parameters. The filter values can be either the same type of value and would be matched directly, or an enumerable and it will return all objects that match any of the values.

[block:code]

{

\"codes\": [

{

\"code\": \"Post* p = [Post create:@{@\\\"tags\\\": @\\\"foo bar baz\\\"}];\

BOOL contains = [[Post find:@{@\\\"tag\\\": @[@\\\"foo\\\", @\\\"bar\\\"]}] contains:p];\

// true\

contains = [[Post find:@{@\\\"tag\\\": @[@\\\"foo\\\", @\\\"bar\\\"]}] contains:p];\

// true\

contains = [[Post find:@{@\\\"tag\\\": @[@\\\"bar\\\", @\\\"baz\\\"]}] contains:p];\

// true\

contains = [[Post find:@{@\\\"tag\\\": @[@\\\"baz\\\", @\\\"oof\\\"]}] contains:p];\

// false\",

\"language\": \"objectivec\",

\"name\": \"Test.m\"

},

{

\"code\": \"@interface Post : OOCModel\

\\[email protected] NSString* tags;\\[email protected] (readonly) NSSet<OOCIndex>* tag;\

\\[email protected]\",

\"language\": \"objectivec\",

\"name\": \"Post.h\"

},

{

\"code\": \"@implementation OOCPost\

\

- (NSSet<OOCIndex>*) tag {\

return (NSSet<OOCIndex>*)[NSSet setWithArray:[self.tags componentsSeparatedByString:@\\\" \\\"]];\

}\

\\[email protected]\",

\"language\": \"text\",

\"name\": \"Post.m\"

}

]

}

[/block]



[block:callout]

{

\"type\": \"info\",

\"title\": \"Syntax equivalency\",

\"body\": \"Calling `OOCModel`.`+find:` is equivalent to `Ohmoc`.`-find:model:` using the OOCModel subclass as second parameter.\"

}

[/block]



[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) with:(NSString*)property is:(id)value model:(Class)modelClass\"

}

[/block]

Gets the instance of `modelClass` where `property` is `value`. Property must have a unique index.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) get:(NSString*)id model:(Class)modelClass\"

}

[/block]

Gets the instance of `modelClass` where id is `id`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) createModel:(Class)modelClass\"

}

[/block]

Create a new blank instance of `modelClass`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) create:(NSDictionary*)properties model:(Class)modelClass\"

}

[/block]

Create a new instance of `modelClass` and applies all the `properties`.

[block:code]

{

\"codes\": [

{

\"code\": \"User* john = [ohmoc create:@{@\\\"fname\\\": @\\\"John\\\", @\\\"lname\\\": @\\\"Doe\\\", @\\\"age\\\": @23} model:[User class]];\

\

john.fname // @\\\"John\\\"\

john.lname // @\\\"Doe\\\"\

john.age // 23\",

\"language\": \"objectivec\",

\"name\": \"Example.m\"

},

{

\"code\": \"@interface OOCUser : OOCModel\

\\[email protected] NSString* fname;\\[email protected] NSString* lname;\\[email protected] int age;\

\\[email protected]\",

\"language\": \"objectivec\",

\"name\": \"User.h\"

}

]

}

[/block]



[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) allModels:(Class)modelClass\"

}

[/block]

Gets all instances of `modelClass`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) flush\"

}

[/block]

Removes all objects from the database.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) multi\"

}

[/block]

Starts a transaction for multiple operations. This will change the instance global state to a write-only mode, allowing you to create and update objects. Notice that every object that's going to be updated needs to have been fetched before calling `multi`. Once all the changes are ready, call `exec`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) exec\"

}

[/block]

Performs all the write operation since `multi` was called.","category":"5529b2a8d739240d00a34845","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} Ohmoc [block:api-header] { "type": "basic", "title": "+ (id) create" } [/block] Creates and initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "+ (id) createWithPath:(NSString*)path" } [/block] Creates and initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "+ (id) createWithDocumentFilename:(NSString*)filename" } [/block] Creates and initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) init" } [/block] Initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initAllowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a memory only storage and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithPath:(NSString*)path" } [/block] Initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithPath:(NSString*)path allowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a file located at path and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithDocumentFilename:(NSString*)filename" } [/block] Initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithDocumentFilename:(NSString*)filename allowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a file name filename in the documents directory and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (OOCSet*) find:(NSDictionary*)dict model:(Class)modelClass" } [/block] Finds all objects of class `Class` that match the filters in `dict`. `Class` must be a subclass of OOCModel. In `dict`, the keys must have an [index](/docs/declaring-models#oocindex). If the value of the object is an enumerable, it will return objects that match all of the parameters. The filter values can be either the same type of value and would be matched directly, or an enumerable and it will return all objects that match any of the values. [block:code] { "codes": [ { "code": "Post* p = [Post create:@{@\"tags\": @\"foo bar baz\"}];

BOOL contains = [[Post find:@{@\"tag\": @[@\"foo\", @\"bar\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"foo\", @\"bar\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"bar\", @\"baz\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"baz\", @\"oof\"]}] contains:p];

// false", "language": "objectivec", "name": "Test.m" }, { "code": "@interface Post : OOCModel

\[email protected] NSString* tags;\[email protected] (readonly) NSSet<OOCIndex>* tag;

\[email protected]", "language": "objectivec", "name": "Post.h" }, { "code": "@implementation OOCPost



- (NSSet<OOCIndex>*) tag {

return (NSSet<OOCIndex>*)[NSSet setWithArray:[self.tags componentsSeparatedByString:@\" \"]];

}

\[email protected]", "language": "text", "name": "Post.m" } ] } [/block] [block:callout] { "type": "info", "title": "Syntax equivalency", "body": "Calling `OOCModel`.`+find:` is equivalent to `Ohmoc`.`-find:model:` using the OOCModel subclass as second parameter." } [/block] [block:api-header] { "type": "basic", "title": "- (id) with:(NSString*)property is:(id)value model:(Class)modelClass" } [/block] Gets the instance of `modelClass` where `property` is `value`. Property must have a unique index. [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)id model:(Class)modelClass" } [/block] Gets the instance of `modelClass` where id is `id`. [block:api-header] { "type": "basic", "title": "- (id) createModel:(Class)modelClass" } [/block] Create a new blank instance of `modelClass`. [block:api-header] { "type": "basic", "title": "- (id) create:(NSDictionary*)properties model:(Class)modelClass" } [/block] Create a new instance of `modelClass` and applies all the `properties`. [block:code] { "codes": [ { "code": "User* john = [ohmoc create:@{@\"fname\": @\"John\", @\"lname\": @\"Doe\", @\"age\": @23} model:[User class]];



john.fname // @\"John\"

john.lname // @\"Doe\"

john.age // 23", "language": "objectivec", "name": "Example.m" }, { "code": "@interface OOCUser : OOCModel

\[email protected] NSString* fname;\[email protected] NSString* lname;\[email protected] int age;

\[email protected]", "language": "objectivec", "name": "User.h" } ] } [/block] [block:api-header] { "type": "basic", "title": "- (OOCSet*) allModels:(Class)modelClass" } [/block] Gets all instances of `modelClass`. [block:api-header] { "type": "basic", "title": "- (void) flush" } [/block] Removes all objects from the database. [block:api-header] { "type": "basic", "title": "- (void) multi" } [/block] Starts a transaction for multiple operations. This will change the instance global state to a write-only mode, allowing you to create and update objects. Notice that every object that's going to be updated needs to have been fetched before calling `multi`. Once all the changes are ready, call `exec`. [block:api-header] { "type": "basic", "title": "- (void) exec" } [/block] Performs all the write operation since `multi` was called. Edit this Page Suggest Edits [block:api-header] { "type": "basic", "title": "+ (id) create" } [/block] Creates and initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "+ (id) createWithPath:(NSString*)path" } [/block] Creates and initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "+ (id) createWithDocumentFilename:(NSString*)filename" } [/block] Creates and initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) init" } [/block] Initializes an Ohmoc instance using a memory only storage and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initAllowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a memory only storage and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithPath:(NSString*)path" } [/block] Initializes an Ohmoc instance using a file located at path and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithPath:(NSString*)path allowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a file located at path and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithDocumentFilename:(NSString*)filename" } [/block] Initializes an Ohmoc instance using a file name filename in the documents directory and [registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (id) initWithDocumentFilename:(NSString*)filename allowDuplicates:(BOOL)allowDuplicates" } [/block] Initializes an Ohmoc instance using a file name filename in the documents directory and [optionally registers the database globally](/docs/multi-threading#allow-duplicates). [block:api-header] { "type": "basic", "title": "- (OOCSet*) find:(NSDictionary*)dict model:(Class)modelClass" } [/block] Finds all objects of class `Class` that match the filters in `dict`. `Class` must be a subclass of OOCModel. In `dict`, the keys must have an [index](/docs/declaring-models#oocindex). If the value of the object is an enumerable, it will return objects that match all of the parameters. The filter values can be either the same type of value and would be matched directly, or an enumerable and it will return all objects that match any of the values. [block:code] { "codes": [ { "code": "Post* p = [Post create:@{@\"tags\": @\"foo bar baz\"}];

BOOL contains = [[Post find:@{@\"tag\": @[@\"foo\", @\"bar\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"foo\", @\"bar\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"bar\", @\"baz\"]}] contains:p];

// true

contains = [[Post find:@{@\"tag\": @[@\"baz\", @\"oof\"]}] contains:p];

// false", "language": "objectivec", "name": "Test.m" }, { "code": "@interface Post : OOCModel

\[email protected] NSString* tags;\[email protected] (readonly) NSSet<OOCIndex>* tag;

\[email protected]", "language": "objectivec", "name": "Post.h" }, { "code": "@implementation OOCPost



- (NSSet<OOCIndex>*) tag {

return (NSSet<OOCIndex>*)[NSSet setWithArray:[self.tags componentsSeparatedByString:@\" \"]];

}

\[email protected]", "language": "text", "name": "Post.m" } ] } [/block] [block:callout] { "type": "info", "title": "Syntax equivalency", "body": "Calling `OOCModel`.`+find:` is equivalent to `Ohmoc`.`-find:model:` using the OOCModel subclass as second parameter." } [/block] [block:api-header] { "type": "basic", "title": "- (id) with:(NSString*)property is:(id)value model:(Class)modelClass" } [/block] Gets the instance of `modelClass` where `property` is `value`. Property must have a unique index. [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)id model:(Class)modelClass" } [/block] Gets the instance of `modelClass` where id is `id`. [block:api-header] { "type": "basic", "title": "- (id) createModel:(Class)modelClass" } [/block] Create a new blank instance of `modelClass`. [block:api-header] { "type": "basic", "title": "- (id) create:(NSDictionary*)properties model:(Class)modelClass" } [/block] Create a new instance of `modelClass` and applies all the `properties`. [block:code] { "codes": [ { "code": "User* john = [ohmoc create:@{@\"fname\": @\"John\", @\"lname\": @\"Doe\", @\"age\": @23} model:[User class]];



john.fname // @\"John\"

john.lname // @\"Doe\"

john.age // 23", "language": "objectivec", "name": "Example.m" }, { "code": "@interface OOCUser : OOCModel

\[email protected] NSString* fname;\[email protected] NSString* lname;\[email protected] int age;

\[email protected]", "language": "objectivec", "name": "User.h" } ] } [/block] [block:api-header] { "type": "basic", "title": "- (OOCSet*) allModels:(Class)modelClass" } [/block] Gets all instances of `modelClass`. [block:api-header] { "type": "basic", "title": "- (void) flush" } [/block] Removes all objects from the database. [block:api-header] { "type": "basic", "title": "- (void) multi" } [/block] Starts a transaction for multiple operations. This will change the instance global state to a write-only mode, allowing you to create and update objects. Notice that every object that's going to be updated needs to have been fetched before calling `multi`. Once all the changes are ready, call `exec`. [block:api-header] { "type": "basic", "title": "- (void) exec" } [/block] Performs all the write operation since `multi` was called.

{"_id":"5529b2a9d739240d00a3484b","updates":[],"project":"55233b29e2de0a3500f0a2f8","user":"55233ae0dbe3622300a3251d","sync_unique":"","version":"5529b2a8d739240d00a34843","category":"5529b2a8d739240d00a34845","order":1,"body":"`OhmocAsync` provides a convenience wrapper around `Ohmoc` to perform the potentially slow operations in a separate thread and then perform a callback into the main thread.



Internally it uses an `NSOperationQueue` with `maxConcurrentOperationCount` of 1. Any synchronously use of `OhmocAsync` will throw an exception.



Notice that all the search operations are not available in this class since those are lazy operations, and thus not performed until needed. See `OOCCollection`.`-each:`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) with:(NSString*)property is:(id)value model:(Class)modelClass callback:(void(^)(id))callback\"

}

[/block]

Async version of [with:is:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) get:(NSString*)id model:(Class)modelClass callback:(void(^)(id))callback\"

}

[/block]

Async version of [get:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) createModel:(Class)modelClass callback:(void(^)(id))callback\"

}

[/block]

Async version of [createModel:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) create:(NSDictionary*)properties model:(Class)modelClass callback:(void(^)(id))callback\"

}

[/block]

Async version of [create:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback.","type":"basic","title":"OhmocAsync : Ohmoc","githubsync":"","api":{"auth":"required","params":[],"url":"","results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"name":"","status":400,"language":"json","code":"{}"}]}},"link_external":false,"link_url":"","hidden":false,"excerpt":"","slug":"ohmocasync","__v":0,"createdAt":"2015-04-07T02:59:09.304Z","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OhmocAsync : Ohmoc `OhmocAsync` provides a convenience wrapper around `Ohmoc` to perform the potentially slow operations in a separate thread and then perform a callback into the main thread. Internally it uses an `NSOperationQueue` with `maxConcurrentOperationCount` of 1. Any synchronously use of `OhmocAsync` will throw an exception. Notice that all the search operations are not available in this class since those are lazy operations, and thus not performed until needed. See `OOCCollection`.`-each:`. [block:api-header] { "type": "basic", "title": "- (void) with:(NSString*)property is:(id)value model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [with:is:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) get:(NSString*)id model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [get:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) createModel:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [createModel:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) create:(NSDictionary*)properties model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [create:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. Edit this Page Suggest Edits `OhmocAsync` provides a convenience wrapper around `Ohmoc` to perform the potentially slow operations in a separate thread and then perform a callback into the main thread. Internally it uses an `NSOperationQueue` with `maxConcurrentOperationCount` of 1. Any synchronously use of `OhmocAsync` will throw an exception. Notice that all the search operations are not available in this class since those are lazy operations, and thus not performed until needed. See `OOCCollection`.`-each:`. [block:api-header] { "type": "basic", "title": "- (void) with:(NSString*)property is:(id)value model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [with:is:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) get:(NSString*)id model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [get:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) createModel:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [createModel:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback. [block:api-header] { "type": "basic", "title": "- (void) create:(NSDictionary*)properties model:(Class)modelClass callback:(void(^)(id))callback" } [/block] Async version of [create:model:](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). The model is provided as an argument to the callback.

{"_id":"5529b2a9d739240d00a3484c","project":"55233b29e2de0a3500f0a2f8","createdAt":"2015-04-07T02:59:28.330Z","link_url":"","githubsync":"","hidden":false,"order":2,"body":"[block:api-header]

{

\"type\": \"basic\",

\"title\": \"@property (readonly) NSString<OOCUnique>* id\"

}

[/block]

Unique identifier of the instance. If `id` does not exist when the object is saved, an autoincrement numeric value is assigned.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCSet*) find:(NSDictionary*)dict\"

}

[/block]

Convenience method for [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (instancetype) with:(NSString*)property is:(id)value\"

}

[/block]

Convenience method for [`Ohmoc`.`-with:is:model:`](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (instancetype) get:(NSString*)id\"

}

[/block]

Convenience method for [`Ohmoc`.`-get:`](/docs/ohmoc#-idgetnsstringid-modelclassmodelclass).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (instancetype) create\"

}

[/block]

Convenience method for [`Ohmoc`.`-createModel:`](/docs/ohmoc#-idcreatemodelclassmodelclass).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (instancetype) create:(NSDictionary*)properties\"

}

[/block]

Convenience method for [`Ohmoc`.`-create:model:`](/docs/ohmoc#-idcreatensdictionaryproperties-modelclassmodelcla).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCSet*) all\"

}

[/block]

Convenience method for [`Ohmoc`.`-allModels:`](/docs/ohmoc#-oocsetallmodelsclassmodelclass).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc\"

}

[/block]

Gets a collection of objects whose `propertyName` is between `min` and `max`.



Optionally, if `filterProperty` is provided, it will only returns the objects with a value `groupByValue` for it.



A `range` may determine a maximum number of elements and an offset.



If `reverse` is true, the elements will be in decreasing order.



`ohmoc` is optional. If not provided, the default instance will be used.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` using false as reverse parameter and the default Ohmoc instance.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter and the default Ohmoc instance.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, and false as reverse.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, false as reverse and no range limit.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max ohmoc:(Ohmoc*)ohmoc\"

}

[/block]

Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, false as reverse and no range limit.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) applyDictionary:(NSDictionary*)properties\"

}

[/block]

Applies all `properties` into the current object. The keys of the `NSDictionary` are mapped to property names and the value converted to the property declared type if possible.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCModel*) initWithId:(NSString*)id ohmoc:(Ohmoc*)ohmoc\"

}

[/block]

Initializes the model with a specific id and `Ohmoc` instance. If the `id` already exists, `load` must be called.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (instancetype) initWithDictionary:(NSDictionary*)properties ohmoc:(Ohmoc*)ohmoc\"

}

[/block]

Initializes the object with an `Ohmoc` instance and [applies the `properties`](/docs/oocmodel#-voidapplydictionarynsdictionaryproperties).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) get:(NSString*)prop\"

}

[/block]

Refreshes the property `prop` from the database and return its value. Notice the value returned is an Objective-C class, which means that c types are wrapped around a container. For example, `int` return instances of `NSNumber`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) set:(NSString*)att value:(id)val\"

}

[/block]

Synchronously writes only the value `val` into the model `att` in the database. This method **does not** update indices, so it must only be used for non-indexed properties.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) save\"

}

[/block]

Writes all properties of the model into the database and updates all indices.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) load\"

}

[/block]

Gets all the model properties from the database. The model must have an `id`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) delete\"

}

[/block]

Remove the object from the database and removes all of its indices.","excerpt":"","__v":0,"user":"55233ae0dbe3622300a3251d","updates":[],"link_external":false,"sync_unique":"","slug":"oocmodel","version":"5529b2a8d739240d00a34843","api":{"results":{"codes":[{"language":"json","code":"{}","name":"","status":200},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"type":"basic","category":"5529b2a8d739240d00a34845","title":"OOCModel","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCModel [block:api-header] { "type": "basic", "title": "@property (readonly) NSString<OOCUnique>* id" } [/block] Unique identifier of the instance. If `id` does not exist when the object is saved, an autoincrement numeric value is assigned. [block:api-header] { "type": "basic", "title": "+ (OOCSet*) find:(NSDictionary*)dict" } [/block] Convenience method for [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) with:(NSString*)property is:(id)value" } [/block] Convenience method for [`Ohmoc`.`-with:is:model:`](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). [block:api-header] { "type": "basic", "title": "+ (instancetype) get:(NSString*)id" } [/block] Convenience method for [`Ohmoc`.`-get:`](/docs/ohmoc#-idgetnsstringid-modelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) create" } [/block] Convenience method for [`Ohmoc`.`-createModel:`](/docs/ohmoc#-idcreatemodelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) create:(NSDictionary*)properties" } [/block] Convenience method for [`Ohmoc`.`-create:model:`](/docs/ohmoc#-idcreatensdictionaryproperties-modelclassmodelcla). [block:api-header] { "type": "basic", "title": "+ (OOCSet*) all" } [/block] Convenience method for [`Ohmoc`.`-allModels:`](/docs/ohmoc#-oocsetallmodelsclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc" } [/block] Gets a collection of objects whose `propertyName` is between `min` and `max`. Optionally, if `filterProperty` is provided, it will only returns the objects with a value `groupByValue` for it. A `range` may determine a maximum number of elements and an offset. If `reverse` is true, the elements will be in decreasing order. `ohmoc` is optional. If not provided, the default instance will be used. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` using false as reverse parameter and the default Ohmoc instance. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter and the default Ohmoc instance. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, and false as reverse. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, false as reverse and no range limit. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max ohmoc:(Ohmoc*)ohmoc" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, false as reverse and no range limit. [block:api-header] { "type": "basic", "title": "- (void) applyDictionary:(NSDictionary*)properties" } [/block] Applies all `properties` into the current object. The keys of the `NSDictionary` are mapped to property names and the value converted to the property declared type if possible. [block:api-header] { "type": "basic", "title": "- (OOCModel*) initWithId:(NSString*)id ohmoc:(Ohmoc*)ohmoc" } [/block] Initializes the model with a specific id and `Ohmoc` instance. If the `id` already exists, `load` must be called. [block:api-header] { "type": "basic", "title": "- (instancetype) initWithDictionary:(NSDictionary*)properties ohmoc:(Ohmoc*)ohmoc" } [/block] Initializes the object with an `Ohmoc` instance and [applies the `properties`](/docs/oocmodel#-voidapplydictionarynsdictionaryproperties). [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)prop" } [/block] Refreshes the property `prop` from the database and return its value. Notice the value returned is an Objective-C class, which means that c types are wrapped around a container. For example, `int` return instances of `NSNumber`. [block:api-header] { "type": "basic", "title": "- (void) set:(NSString*)att value:(id)val" } [/block] Synchronously writes only the value `val` into the model `att` in the database. This method **does not** update indices, so it must only be used for non-indexed properties. [block:api-header] { "type": "basic", "title": "- (void) save" } [/block] Writes all properties of the model into the database and updates all indices. [block:api-header] { "type": "basic", "title": "- (void) load" } [/block] Gets all the model properties from the database. The model must have an `id`. [block:api-header] { "type": "basic", "title": "- (void) delete" } [/block] Remove the object from the database and removes all of its indices. Edit this Page Suggest Edits [block:api-header] { "type": "basic", "title": "@property (readonly) NSString<OOCUnique>* id" } [/block] Unique identifier of the instance. If `id` does not exist when the object is saved, an autoincrement numeric value is assigned. [block:api-header] { "type": "basic", "title": "+ (OOCSet*) find:(NSDictionary*)dict" } [/block] Convenience method for [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) with:(NSString*)property is:(id)value" } [/block] Convenience method for [`Ohmoc`.`-with:is:model:`](/docs/ohmoc#-id-withnsstringproperty-isidvalue-modelclassmodel). [block:api-header] { "type": "basic", "title": "+ (instancetype) get:(NSString*)id" } [/block] Convenience method for [`Ohmoc`.`-get:`](/docs/ohmoc#-idgetnsstringid-modelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) create" } [/block] Convenience method for [`Ohmoc`.`-createModel:`](/docs/ohmoc#-idcreatemodelclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (instancetype) create:(NSDictionary*)properties" } [/block] Convenience method for [`Ohmoc`.`-create:model:`](/docs/ohmoc#-idcreatensdictionaryproperties-modelclassmodelcla). [block:api-header] { "type": "basic", "title": "+ (OOCSet*) all" } [/block] Convenience method for [`Ohmoc`.`-allModels:`](/docs/ohmoc#-oocsetallmodelsclassmodelclass). [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc" } [/block] Gets a collection of objects whose `propertyName` is between `min` and `max`. Optionally, if `filterProperty` is provided, it will only returns the objects with a value `groupByValue` for it. A `range` may determine a maximum number of elements and an offset. If `reverse` is true, the elements will be in decreasing order. `ohmoc` is optional. If not provided, the default instance will be used. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)propertyName scoreBetween:(double)min and:(double)max andProperty:(NSString*)filterProperty is:(id)groupByValue range:(NSRange)range" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` using false as reverse parameter and the default Ohmoc instance. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse ohmoc:(Ohmoc*)ohmoc" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range reverse:(BOOL)reverse" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter and the default Ohmoc instance. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max range:(NSRange)range" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, and false as reverse. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, the default Ohmoc instance, false as reverse and no range limit. [block:api-header] { "type": "basic", "title": "+ (OOCCollection*) collectionWithProperty:(NSString*)property scoreBetween:(double)min and:(double)max ohmoc:(Ohmoc*)ohmoc" } [/block] Calls `+collectionWithProperty:scoreBetween:and:andProperty:is:range:reverse:ohmoc:` with no property filter, false as reverse and no range limit. [block:api-header] { "type": "basic", "title": "- (void) applyDictionary:(NSDictionary*)properties" } [/block] Applies all `properties` into the current object. The keys of the `NSDictionary` are mapped to property names and the value converted to the property declared type if possible. [block:api-header] { "type": "basic", "title": "- (OOCModel*) initWithId:(NSString*)id ohmoc:(Ohmoc*)ohmoc" } [/block] Initializes the model with a specific id and `Ohmoc` instance. If the `id` already exists, `load` must be called. [block:api-header] { "type": "basic", "title": "- (instancetype) initWithDictionary:(NSDictionary*)properties ohmoc:(Ohmoc*)ohmoc" } [/block] Initializes the object with an `Ohmoc` instance and [applies the `properties`](/docs/oocmodel#-voidapplydictionarynsdictionaryproperties). [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)prop" } [/block] Refreshes the property `prop` from the database and return its value. Notice the value returned is an Objective-C class, which means that c types are wrapped around a container. For example, `int` return instances of `NSNumber`. [block:api-header] { "type": "basic", "title": "- (void) set:(NSString*)att value:(id)val" } [/block] Synchronously writes only the value `val` into the model `att` in the database. This method **does not** update indices, so it must only be used for non-indexed properties. [block:api-header] { "type": "basic", "title": "- (void) save" } [/block] Writes all properties of the model into the database and updates all indices. [block:api-header] { "type": "basic", "title": "- (void) load" } [/block] Gets all the model properties from the database. The model must have an `id`. [block:api-header] { "type": "basic", "title": "- (void) delete" } [/block] Remove the object from the database and removes all of its indices.

{"_id":"5529b2a9d739240d00a3484d","createdAt":"2015-04-07T03:00:04.272Z","link_url":"","body":"A Collection represents an unsorted set or sorted list of models of the same type.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (BOOL) isEmpty\"

}

[/block]

Whether the collection has any object in it or not.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (NSArray*)arrayValue\"

}

[/block]

An array with all the models in the collection.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (NSUInteger) size\"

}

[/block]

Number of models in the collection.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (BOOL) contains:(OOCModel*)model\"

}

[/block]

Whether the collection contains a specific object or not.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCList*) sortBy:(NSString*)by limit:(NSUInteger)limit offset:(NSUInteger)offset order:(NSString*)order\"

}

[/block]

A list (sorted collection) sorted by `by`, with up to `limit` elements starting in `offset`.



`order` allows to specify how to compare the properties. By default a numeric comparison is made. Its format is `[ALPHA] [ASC|DESC]`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCList*) sortBy:(NSString*)by order:(NSString*)order\"

}

[/block]

Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCList*) sortBy:(NSString*)by\"

}

[/block]

Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit, and using a numeric sort.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void)each:(void(^)(id obj, NSUInteger pos, NSUInteger size))block\"

}

[/block]

Asynchronously calls `block` on the main thread with each element in the collection.



The `block` receives the model `obj`, the iteration position `pos` and the total number of elements `size` in the collection. If the collection is empty, `block` will be called with no `obj`, and a 0 `pos` and `size`.



Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void)arrayValueCallback:(void(^)(NSArray* arr))block\"

}

[/block]

Asynchronously creates an array with all the models in the collection and calls `block` on the main thread.



Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance.","slug":"ooccollection","version":"5529b2a8d739240d00a34843","project":"55233b29e2de0a3500f0a2f8","githubsync":"","type":"basic","order":3,"__v":0,"updates":[],"sync_unique":"","hidden":false,"api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"code":"{}","name":"","status":400,"language":"json"}]},"auth":"required","params":[],"url":""},"category":"5529b2a8d739240d00a34845","user":"55233ae0dbe3622300a3251d","link_external":false,"excerpt":"","title":"OOCCollection <NSFastEnumeration>","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCCollection <NSFastEnumeration> A Collection represents an unsorted set or sorted list of models of the same type. [block:api-header] { "type": "basic", "title": "- (BOOL) isEmpty" } [/block] Whether the collection has any object in it or not. [block:api-header] { "type": "basic", "title": "- (NSArray*)arrayValue" } [/block] An array with all the models in the collection. [block:api-header] { "type": "basic", "title": "- (NSUInteger) size" } [/block] Number of models in the collection. [block:api-header] { "type": "basic", "title": "- (BOOL) contains:(OOCModel*)model" } [/block] Whether the collection contains a specific object or not. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by limit:(NSUInteger)limit offset:(NSUInteger)offset order:(NSString*)order" } [/block] A list (sorted collection) sorted by `by`, with up to `limit` elements starting in `offset`. `order` allows to specify how to compare the properties. By default a numeric comparison is made. Its format is `[ALPHA] [ASC|DESC]`. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by order:(NSString*)order" } [/block] Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by" } [/block] Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit, and using a numeric sort. [block:api-header] { "type": "basic", "title": "- (void)each:(void(^)(id obj, NSUInteger pos, NSUInteger size))block" } [/block] Asynchronously calls `block` on the main thread with each element in the collection. The `block` receives the model `obj`, the iteration position `pos` and the total number of elements `size` in the collection. If the collection is empty, `block` will be called with no `obj`, and a 0 `pos` and `size`. Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance. [block:api-header] { "type": "basic", "title": "- (void)arrayValueCallback:(void(^)(NSArray* arr))block" } [/block] Asynchronously creates an array with all the models in the collection and calls `block` on the main thread. Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance. Edit this Page Suggest Edits A Collection represents an unsorted set or sorted list of models of the same type. [block:api-header] { "type": "basic", "title": "- (BOOL) isEmpty" } [/block] Whether the collection has any object in it or not. [block:api-header] { "type": "basic", "title": "- (NSArray*)arrayValue" } [/block] An array with all the models in the collection. [block:api-header] { "type": "basic", "title": "- (NSUInteger) size" } [/block] Number of models in the collection. [block:api-header] { "type": "basic", "title": "- (BOOL) contains:(OOCModel*)model" } [/block] Whether the collection contains a specific object or not. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by limit:(NSUInteger)limit offset:(NSUInteger)offset order:(NSString*)order" } [/block] A list (sorted collection) sorted by `by`, with up to `limit` elements starting in `offset`. `order` allows to specify how to compare the properties. By default a numeric comparison is made. Its format is `[ALPHA] [ASC|DESC]`. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by order:(NSString*)order" } [/block] Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit. [block:api-header] { "type": "basic", "title": "- (OOCList*) sortBy:(NSString*)by" } [/block] Calls [-sortBy:limit:offset:order:](/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off) using `by` and `order`, without a limit, and using a numeric sort. [block:api-header] { "type": "basic", "title": "- (void)each:(void(^)(id obj, NSUInteger pos, NSUInteger size))block" } [/block] Asynchronously calls `block` on the main thread with each element in the collection. The `block` receives the model `obj`, the iteration position `pos` and the total number of elements `size` in the collection. If the collection is empty, `block` will be called with no `obj`, and a 0 `pos` and `size`. Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance. [block:api-header] { "type": "basic", "title": "- (void)arrayValueCallback:(void(^)(NSArray* arr))block" } [/block] Asynchronously creates an array with all the models in the collection and calls `block` on the main thread. Requires the collection to have be fetched using an [OhmocAsync : Ohmoc](doc:ohmocasync) instance.

{"_id":"5529b2a9d739240d00a3484e","__v":0,"project":"55233b29e2de0a3500f0a2f8","user":"55233ae0dbe3622300a3251d","hidden":false,"excerpt":"Unsorted collection","slug":"oocset","sync_unique":"","version":"5529b2a8d739240d00a34843","githubsync":"","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"name":"","status":400,"language":"json","code":"{}"}]},"auth":"required","params":[],"url":""},"title":"OOCSet : OOCCollection","body":"[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) get:(NSString*)id\"

}

[/block]

Gets a model by `id` if it belongs to the set.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) find:(NSDictionary*)dict\"

}

[/block]

Creates a new set by keeping only the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass)

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) except:(NSDictionary*)dict\"

}

[/block]

Creates a new set by removing all the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass)

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) combine:(NSDictionary*)dict\"

}

[/block]

Creates a new set by keeping only the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass)

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCSet*) union:(NSDictionary*)dict\"

}

[/block]

Creates a new set by adding all the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass)

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) first\"

}

[/block]

Returns any element in the set.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) firstBy:(NSString*)by get:(NSString*)get order:(NSString*)order\"

}

[/block]

Returns the `get` property of the first element in the set sorted by `by` using an `order` criteria.



For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off).

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) firstBy:(NSString*)by order:(NSString*)order\"

}

[/block]

Returns the first element in the set sorted by `by` using an `order` criteria.



For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off).","type":"basic","category":"5529b2a8d739240d00a34845","updates":[],"createdAt":"2015-04-07T03:00:10.847Z","link_external":false,"link_url":"","order":4,"metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCSet : OOCCollection Unsorted collection [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)id" } [/block] Gets a model by `id` if it belongs to the set. [block:api-header] { "type": "basic", "title": "- (OOCSet*) find:(NSDictionary*)dict" } [/block] Creates a new set by keeping only the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) except:(NSDictionary*)dict" } [/block] Creates a new set by removing all the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) combine:(NSDictionary*)dict" } [/block] Creates a new set by keeping only the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) union:(NSDictionary*)dict" } [/block] Creates a new set by adding all the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (id) first" } [/block] Returns any element in the set. [block:api-header] { "type": "basic", "title": "- (id) firstBy:(NSString*)by get:(NSString*)get order:(NSString*)order" } [/block] Returns the `get` property of the first element in the set sorted by `by` using an `order` criteria. For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off). [block:api-header] { "type": "basic", "title": "- (id) firstBy:(NSString*)by order:(NSString*)order" } [/block] Returns the first element in the set sorted by `by` using an `order` criteria. For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off). Edit this Page Suggest Edits [block:api-header] { "type": "basic", "title": "- (id) get:(NSString*)id" } [/block] Gets a model by `id` if it belongs to the set. [block:api-header] { "type": "basic", "title": "- (OOCSet*) find:(NSDictionary*)dict" } [/block] Creates a new set by keeping only the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) except:(NSDictionary*)dict" } [/block] Creates a new set by removing all the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) combine:(NSDictionary*)dict" } [/block] Creates a new set by keeping only the elements that satisfy any condition in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (OOCSet*) union:(NSDictionary*)dict" } [/block] Creates a new set by adding all the elements that satisfy all conditions in `dict`. For `dict` format see [`Ohmoc`.`-find:model:`](/docs/ohmoc#-oocset-findnsdictionarydict-modelclassmodelclass) [block:api-header] { "type": "basic", "title": "- (id) first" } [/block] Returns any element in the set. [block:api-header] { "type": "basic", "title": "- (id) firstBy:(NSString*)by get:(NSString*)get order:(NSString*)order" } [/block] Returns the `get` property of the first element in the set sorted by `by` using an `order` criteria. For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off). [block:api-header] { "type": "basic", "title": "- (id) firstBy:(NSString*)by order:(NSString*)order" } [/block] Returns the first element in the set sorted by `by` using an `order` criteria. For more information about these parameters see [`Ohmoc`.`-sortBy:limit:offset:order:](/docs/ooccollection#-ooclist-sortbynsstringby-limitnsuintegerlimit-off).

{"_id":"5529b2a9d739240d00a34850","category":"5529b2a8d739240d00a34845","updates":[],"createdAt":"2015-04-07T03:01:04.351Z","githubsync":"","body":"[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) add:(OOCModel*)model\"

}

[/block]

Adds a model to the set.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) remove:(OOCModel*)model\"

}

[/block]

Removes a model from the set.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) replace:(id<NSFastEnumeration>)models\"

}

[/block]

Removes all objects in the set and adds the ones specified in `models`.","slug":"oocmutableset","__v":0,"order":5,"project":"55233b29e2de0a3500f0a2f8","user":"55233ae0dbe3622300a3251d","link_external":false,"sync_unique":"","excerpt":"Unsorted mutable collection","type":"basic","version":"5529b2a8d739240d00a34843","link_url":"","hidden":false,"api":{"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[]},"title":"OOCMutableSet : OOCSet","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCMutableSet : OOCSet Unsorted mutable collection [block:api-header] { "type": "basic", "title": "- (void) add:(OOCModel*)model" } [/block] Adds a model to the set. [block:api-header] { "type": "basic", "title": "- (void) remove:(OOCModel*)model" } [/block] Removes a model from the set. [block:api-header] { "type": "basic", "title": "- (void) replace:(id<NSFastEnumeration>)models" } [/block] Removes all objects in the set and adds the ones specified in `models`. Edit this Page Suggest Edits [block:api-header] { "type": "basic", "title": "- (void) add:(OOCModel*)model" } [/block] Adds a model to the set. [block:api-header] { "type": "basic", "title": "- (void) remove:(OOCModel*)model" } [/block] Removes a model from the set. [block:api-header] { "type": "basic", "title": "- (void) replace:(id<NSFastEnumeration>)models" } [/block] Removes all objects in the set and adds the ones specified in `models`.

{"_id":"5529b2a9d739240d00a3484f","createdAt":"2015-04-07T03:00:18.366Z","api":{"results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"excerpt":"Sorted mutable collection","project":"55233b29e2de0a3500f0a2f8","updates":[],"sync_unique":"","hidden":false,"type":"basic","user":"55233ae0dbe3622300a3251d","__v":0,"githubsync":"","order":6,"body":"[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (id) objectAtIndex:(NSInteger)index\"

}

[/block]

Returns the model in position `index`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCModel*) first\"

}

[/block]

Returns the first model in the list.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCModel*) last\"

}

[/block]

Returns the last model in the list.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (OOCCollection*) collectionWithRange:(NSRange)range\"

}

[/block]

Returns a new collection with the objects within `range`. The new collection keeps the order, and is immutable.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) replace:(id<NSFastEnumeration>)models\"

}

[/block]

Removes all objects from the list and adds in the same order all the `models`.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) push:(OOCModel*)model\"

}

[/block]

Adds a model at the end of the list.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) unshift:(OOCModel*)model\"

}

[/block]

Adds a model at the beginning of the list.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (void) remove:(OOCModel*)model\"

}

[/block]

Removes all occurrences of `model` in the list.

[block:api-header]

{

\"type\": \"basic\",

\"title\": \"- (NSArray*) ids\"

}

[/block]

Returns an array with the id of the objects in the list.","title":"OOCList : OOCCollection","category":"5529b2a8d739240d00a34845","link_external":false,"link_url":"","slug":"ooclist","version":"5529b2a8d739240d00a34843","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCList : OOCCollection Sorted mutable collection [block:api-header] { "type": "basic", "title": "- (id) objectAtIndex:(NSInteger)index" } [/block] Returns the model in position `index`. [block:api-header] { "type": "basic", "title": "- (OOCModel*) first" } [/block] Returns the first model in the list. [block:api-header] { "type": "basic", "title": "- (OOCModel*) last" } [/block] Returns the last model in the list. [block:api-header] { "type": "basic", "title": "- (OOCCollection*) collectionWithRange:(NSRange)range" } [/block] Returns a new collection with the objects within `range`. The new collection keeps the order, and is immutable. [block:api-header] { "type": "basic", "title": "- (void) replace:(id<NSFastEnumeration>)models" } [/block] Removes all objects from the list and adds in the same order all the `models`. [block:api-header] { "type": "basic", "title": "- (void) push:(OOCModel*)model" } [/block] Adds a model at the end of the list. [block:api-header] { "type": "basic", "title": "- (void) unshift:(OOCModel*)model" } [/block] Adds a model at the beginning of the list. [block:api-header] { "type": "basic", "title": "- (void) remove:(OOCModel*)model" } [/block] Removes all occurrences of `model` in the list. [block:api-header] { "type": "basic", "title": "- (NSArray*) ids" } [/block] Returns an array with the id of the objects in the list. Edit this Page Suggest Edits [block:api-header] { "type": "basic", "title": "- (id) objectAtIndex:(NSInteger)index" } [/block] Returns the model in position `index`. [block:api-header] { "type": "basic", "title": "- (OOCModel*) first" } [/block] Returns the first model in the list. [block:api-header] { "type": "basic", "title": "- (OOCModel*) last" } [/block] Returns the last model in the list. [block:api-header] { "type": "basic", "title": "- (OOCCollection*) collectionWithRange:(NSRange)range" } [/block] Returns a new collection with the objects within `range`. The new collection keeps the order, and is immutable. [block:api-header] { "type": "basic", "title": "- (void) replace:(id<NSFastEnumeration>)models" } [/block] Removes all objects from the list and adds in the same order all the `models`. [block:api-header] { "type": "basic", "title": "- (void) push:(OOCModel*)model" } [/block] Adds a model at the end of the list. [block:api-header] { "type": "basic", "title": "- (void) unshift:(OOCModel*)model" } [/block] Adds a model at the beginning of the list. [block:api-header] { "type": "basic", "title": "- (void) remove:(OOCModel*)model" } [/block] Removes all occurrences of `model` in the list. [block:api-header] { "type": "basic", "title": "- (NSArray*) ids" } [/block] Returns an array with the id of the objects in the list.

{"_id":"5529b2a9d739240d00a34851","version":"5529b2a8d739240d00a34843","__v":0,"link_url":"","title":"OOCException","user":"55233ae0dbe3622300a3251d","hidden":false,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"name":"","status":200,"language":"json","code":"{}"},{"language":"json","code":"{}","name":"","status":400}]}},"excerpt":"","project":"55233b29e2de0a3500f0a2f8","createdAt":"2015-04-07T03:01:34.489Z","githubsync":"","order":7,"body":"Exceptions thrown by Ohmoc.","slug":"oocexception","category":"5529b2a8d739240d00a34845","updates":[],"link_external":false,"sync_unique":"","type":"basic","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCException Exceptions thrown by Ohmoc. Edit this Page Suggest Edits Exceptions thrown by Ohmoc.

{"_id":"5529b2a9d739240d00a34852","user":"55233ae0dbe3622300a3251d","updates":[],"slug":"oocindexnotfoundexception","githubsync":"","body":"Thrown when trying to do a lookup by a property that does not have an index.","excerpt":"","version":"5529b2a8d739240d00a34843","__v":0,"createdAt":"2015-04-07T03:01:47.684Z","link_external":false,"sync_unique":"","type":"basic","category":"5529b2a8d739240d00a34845","project":"55233b29e2de0a3500f0a2f8","link_url":"","hidden":false,"api":{"results":{"codes":[{"code":"{}","name":"","status":200,"language":"json"},{"status":400,"language":"json","code":"{}","name":""}]},"auth":"required","params":[],"url":""},"order":8,"title":"OOCIndexNotFoundException : OOCException","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCIndexNotFoundException : OOCException Thrown when trying to do a lookup by a property that does not have an index. Edit this Page Suggest Edits Thrown when trying to do a lookup by a property that does not have an index.

{"_id":"5529b2a9d739240d00a34853","updates":[],"sync_unique":"","order":9,"title":"OOCMissingIDException : OOCException","project":"55233b29e2de0a3500f0a2f8","createdAt":"2015-04-07T03:01:53.016Z","link_external":false,"hidden":false,"api":{"auth":"required","params":[],"url":"","results":{"codes":[{"status":200,"language":"json","code":"{}","name":""},{"status":400,"language":"json","code":"{}","name":""}]}},"body":"Thrown when trying to use a collection property before calling `save`.



Internally, the collections are stored as a separated key, therefore an `id` is needed to allow this. Calling `create` or `save` on new instances will set an `id`.","version":"5529b2a8d739240d00a34843","githubsync":"","excerpt":"","slug":"oocmissingidexception","link_url":"","__v":0,"user":"55233ae0dbe3622300a3251d","type":"basic","category":"5529b2a8d739240d00a34845","metadata":{"title":"","description":"","image":[]},"childrenPages":[]} OOCMissingIDException : OOCException Thrown when trying to use a collection property before calling `save`. Internally, the collections are stored as a separated key, therefore an `id` is needed to allow this. Calling `create` or `save` on new instances will set an `id`. Edit this Page Suggest Edits Thrown when trying to use a collection property before calling `save`. Internally, the collections are stored as a separated key, therefore an `id` is needed to allow this. Calling `create` or `save` on new instances will set an `id`.