MONGOID VS MONGOMAPPER ?
Mongoid is completely Rails 3 compatible, and uses ActiveModel all
over the place (validations, serialization, etc), where MongoMapper is still focused on Rails 2 and uses the validatable gem for its validations.
Mongoid officially supports and works on Ruby 1.8.7, 1.9.1, and 1.9.2 head.
Mongoid supports embedded documents more robustly, performing the MongoDB atomic operations on any area of the hierarchy internally. ($set, $push, $pull, etc). With MM you need to explicitly tell it to do these operations.
MongoMapper has better relational association support and works like this as default.
MongoMapper is more extensible, with a plugin architecture that makes it pretty easy for people to extend it with their own libraries. Mongoid does not have this.
MM supports identity maps, Mongoid does not.
MM has a larger community, and probably more 3rd party library support. I went crazy on documentation and rdoc.
Mongoid supports Master/Slave replication clusters. (Writes to master, round robin reads to slaves) MM does not.
Mongoid has an extremely rich ARel style criteria API, MM use AR2 style finders. (Ed: This may not be such a big issue in MM's case since version 0.8 added a new query DSL.)
The biggest comment I have gotten from people, and why I designed Mongoid the way I did is predictability. For one, wrapping the driver cursor when dealing with huge documents and lots of them (in the millions) needs to have predictable performance and memory consumption. We noticed MM didn't deal with large documents (over 500k in size) very well as far as these characteristics go, but handles small documents better than Mongoid. (This may have changed over the past few months, but was an issue for us and others I have talked to.)
=>mongodb is server
=>mongo is shell
=>default port no. 27017
$mongo #=> enter the mongo console
$show dbs #=> see the list of available dbs
$use my_database #=> switch to your database
$db.table_name.getIndexes() #=> replace table_name with your's
$db => to find current database
$show collections =>to list all collections
db.tablename.find;
db.tablename.find();
http://docs.mongodb.org/manual/tutorial/getting-started/#create-a-collection-and-insert-documents
http://stackoverflow.com/questions/2124274/mongodb-what-to-know-before-using
http://docs.mongodb.org/manual/tutorial/model-tree-structures-with-parent-references/
http://railskey.wordpress.com/2011/10/23/mongodb-queries/
http://stackoverflow.com/questions/14849104/find-the-list-of-list-of-indexed-keys-in-mongomapper
Start mongo server:
sudo rm /var/lib/mongodb/mongod.lock
sudo -u mongodb mongod -f /etc/mongodb.conf --repair
sudo service mongodb start
s
No comments:
Post a Comment