/roʊˈdæn/
This is an object modeling tool for MongoDB, based on mongo dart.
This library is not yet finished! Do not use.
The name comes from Auguste Rodin who was a french sculptor.
Define models- Define subcollections
Query for records withmyModel.find()
- Insert records
- Update records
- Delete records
- Use specifications such as index, requied, compound index, etc...
- Add a validation system
Until reflection for metadata is possible in dart, the configuration for Models is a bit noisy and temporary.
This is how you'll define the models as soon as it's done:
@CompoundIndex({ "firstName": Direction.ASC, "lastName": Direction.DESC })
class UserModel extends Model {
@Required()
@Unique()
String username;
String firstName;
String lastName;
}
UserModel user = new UserModel()
..username = "enyo"
..firstName = "Matias"
..lastName = "Meno"
..insert(); // And insert the record in the database.
For now you'll have to specify the specifications like this:
class UserModel extends Model {
String username;
String firstName;
String lastName;
static Map<String, List<Specification>> specifications = {
"_MODEL_": [ const CompoundIndex(const { "firstName": Direction.ASC, "lastName": Direction.DESC }) ],
"username": [ const Required(), const Unique() ]
};
}
The database implementation of rodin is very decoupled of the rest. So it isn't difficult to write other database adapters for it. I might extend it for other databases some day.