glassy-mongo-odm
Version, currently master branch1 version
- master branchlatestNov 1, 2020
github.com/glassy-framework/glassy-mongo-odm
Mongo ODM (Object Document Mapper) with repositories for crystal lang
1 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
glassy-mongo-odm:
github: glassy-framework/glassy-mongo-odm
branch: mastermaster is a branch, not a release, so this tracks it rather than pinning a version.
Then run:
shards installshard.yml
- Crystal
0.35.1- License
- MIT
- Author
- Anderson Danilo
Dependencies
Runtime Dependencies
- mongo*github: kimvex/mongodb-crystal, branch: master
- glassy-kernel*github: glassy-framework/glassy-kernel, branch: master
- glassy-console*github: glassy-framework/glassy-console, branch: master
README
glassy-mongo-odm
Mongo ODM (Object Document Mapper) with repositories for crystal lang
TODO
- [x] Serialize & Deserialize
- [ ] Connection Pool
- [ ] Thread Safety
Currently, in the container, we are creating several instances
Installation
-
Add the dependency to your
shard.yml:dependencies: glassy-mongodb-odm: github: glassy-framework/glassy-mongo-odm -
Run
shards install
Usage
require "glassy-mongo-odm"
include Glassy::MongoODM::Annotations
@[ODM::Document]
class User
@[ODM::Id]
property id : BSON::ObjectId?
@[ODM::Field(name: "Name")]
property name : String
@[ODM::Field]
property birth_date : Time
@[ODM::Field]
property mother : Mother?
@[ODM::Document]
class Mother
@[ODM::Field]
property name : String?
end
def initialize(@name, @birth_date)
end
end
class UserRepository < Glassy::MongoODM::Repository(User)
end
conn = Glassy::MongoODM::Connection.new("mongodb://mongo", db_name)
repository = UserRepository.new(conn)
user = User.new(name: "My Name", birth_date: Time.local)
repository.save(user)
Development
Always run crystal spec before submiting code
Contributing
- Fork it (https://github.com/glassy-framework/glassy-mongo-odm/fork)
- Create your feature branch (
git checkout -b feature/my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin feature/my-new-feature) - Create a new Pull Request
Contributors
- Anderson Danilo - creator and maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This branch
- Branch
master- Seen
- Nov 1, 2020
- Crystal
0.35.1- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/glassy-framework/glassy-mongo-odm
Metadata
- Created
- Aug 19, 2026
- Updated
- Aug 19, 2026
- Synced
- Aug 19, 2026
- Versions
- 1