mirror of
https://github.com/status-im/realm-js.git
synced 2025-01-11 06:46:03 +00:00
Update README.md
This commit is contained in:
parent
dc7ff590a0
commit
ad23a4b886
16
README.md
16
README.md
@ -90,15 +90,15 @@ You can see more examples of how to use these APIs in the [ReactExample](https:/
|
||||
|
||||
## Documentation
|
||||
### `Realm` Constructor Options
|
||||
#### `new Realm(config)`
|
||||
The configuration passed can contain the following:
|
||||
#### `new Realm(realmConfig)`
|
||||
The `realmConfig` passed to the constructor can contain the following:
|
||||
- `schema` – required when first accessing a realm - array of `ObjectSchema` or object constructors (see below)
|
||||
- `path` – optional - defaults to `Realm.defaultPath` (which initially is `'Documents/default.realm'`)
|
||||
- `schemaVersion` – optiona - defaults to `0` but must be specified and incremented after changing the schema
|
||||
- `schemaVersion` – optional - defaults to `0` but must be specified and incremented after changing the schema
|
||||
|
||||
### ObjectSchema
|
||||
- `name` – required - string used to refer to this object type
|
||||
- `properties` - required – array of property defitions (see below)
|
||||
- `name` – string used to refer to this object type
|
||||
- `properties` - array of property defitions (see below)
|
||||
- `primaryKey` – optional - name of `STRING` or `INT` property that should be unique
|
||||
|
||||
### Property Types
|
||||
@ -123,7 +123,7 @@ You _may_ specify these property options as well:
|
||||
#### `create(type, props [, update])`
|
||||
- `type` – string matching object `name` in the `schema` definition
|
||||
- `props` – object with property values for all required properties without a default value
|
||||
- `update` – optional boolean signaling that an existing object (matching primary key) should be updated - only the primary key property and properties which should be updated need to be specified for the `props` arguments - all missing property values will remain unchanged
|
||||
- `update` – optional - boolean signaling that an existing object (matching primary key) should be updated - only the primary key property and properties which should be updated need to be specified for the `props` arguments - all missing property values will remain unchanged
|
||||
- _Returns a new realm object instance_
|
||||
|
||||
#### `delete(object, ..., objectN)`
|
||||
@ -133,8 +133,8 @@ You _may_ specify these property options as well:
|
||||
**WARNING:** This does what you think it does!
|
||||
|
||||
#### `objects(type [, query])`
|
||||
- `type` – string matching object `name` in the `schema` definition
|
||||
- `query` – optional string that defines a query to filter results (see tests for examples)
|
||||
- `type` - string matching object `name` in the `schema` definition
|
||||
- `query` – optional - string that defines a query to filter results (see tests for examples)
|
||||
- _Returns `Results` object_
|
||||
|
||||
#### `write(callback)`
|
||||
|
Loading…
x
Reference in New Issue
Block a user