[](https://app.codacy.com/gh/artis-auxilium/realm-orm/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage) [
static stringFields = ['name']
}
`
create a new db instance with realm option
(path, schema, migration, etc...) and open it
`js`
import DB from 'realm-orm'
import Person from './models/Person'
realm = new DB({
schema: [
Person
]
});
realm.open().then(() => {
// realm is ready
})
insert data in database (data can be array or object).
If you insert object with same primary key realm
update existing object
`js
Person.insert([{
id: 1,
name: 'second person',
age: 16,
createdAt: new Date(),
}, {
id: 2,
name: 'third person',
age: 96,
createdAt: new Date(),
}]);
`
get a record
`js`
person = Person.find(1)`
update personjs`
person.update({ age: 10 })`
delete personjs`
person.delete()
// or
Person.delete(person)
query model
`js`
let oldPeople = Person.query()
.greaterThan('age', 90)
.findAll();
// results can use query
oldPeople.query()
_For more examples and usage, please refer to the doc._
* Realm-query: starting point of query builder
* 1.0.0
* initial version
Distributed under the MIT license. See LICENSE for more information.
https://github.com/artis-auxilium/realm-orm
)
* Commit your changes (git commit -am 'Add some fooBar')
* Push to the branch (git push origin feature/fooBar`)