georgepalmer-couch_foo 0.7.11 → 0.7.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +5 -5
- data/VERSION.yml +1 -1
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -3,9 +3,9 @@
|
|
3
3
|
== Introduction
|
4
4
|
|
5
5
|
CouchDB (http://couchdb.apache.org/) works slightly differently to relational databases. First,
|
6
|
-
and foremost, it is a document-
|
6
|
+
and foremost, it is a document-oriented database. That is, data is stored in documents each
|
7
7
|
of which have a unique id that is used to access and modify it. The contents of the documents
|
8
|
-
are free from structure (or schema free) and
|
8
|
+
are free from structure (or schema free) and bear no relation to one another (unless you encode
|
9
9
|
that within the documents themselves). So in many ways documents are like records within a
|
10
10
|
relational database except there are no tables to keep documents of the same type in.
|
11
11
|
|
@@ -31,7 +31,7 @@ where you wish to run local copies of the database.
|
|
31
31
|
CouchFoo provides an ActiveRecord styled interface to CouchDB. The external API is nearly identical
|
32
32
|
to ActiveRecord so it should be possible to migrate your applications quite easily. That said, there
|
33
33
|
are a few minor differences to the way CouchDB works. In particular:
|
34
|
-
* CouchDB is schema free so property
|
34
|
+
* CouchDB is schema free so property definitions for the document are defined in the model (like DataMapper)
|
35
35
|
* :select, :joins, :having, :group, :from and :lock are not available on find or associations as they don't apply (locking is handled as conflict resolution at insertion time)
|
36
36
|
* :conditions can only accept a hash and not an array or SQL. For example :conditions => {:user_name => "Georgio_1999"}
|
37
37
|
* :offset is less efficient in CouchDB - there's more on this in the rdoc
|
@@ -66,7 +66,7 @@ Basic operations are the same as ActiveRecord:
|
|
66
66
|
|
67
67
|
address1 = Address.create(:number => 3, :street => "My Street", :postcode => "secret") # Create address
|
68
68
|
address2 = Address.create(:number => 27, :street => "Another Street", :postcode => "secret")
|
69
|
-
Address.find.all # = [address1, address2] or maybe [address2,
|
69
|
+
Address.find.all # = [address1, address2] or maybe [address2, address1] depending on key generation
|
70
70
|
Address.first # = address1 or address2 depending on keys so probably isn't as expected
|
71
71
|
Address.find_by_street("My Street") # = address1
|
72
72
|
|
@@ -90,7 +90,7 @@ Conditions work slightly differently:
|
|
90
90
|
Address.find(:all, :conditions {:created_at => "sometime"}) # Uses same index as :use_key => :created_at
|
91
91
|
Address.find(:all, :use_key => :street, :startkey => 'p') # All streets from p in alphabet, reuses the index created 2 lines up
|
92
92
|
|
93
|
-
As well as providing support for people using relational databases, CouchFoo attempts to provide a library for those wanting to use CouchDB as a document-
|
93
|
+
As well as providing support for people using relational databases, CouchFoo attempts to provide a library for those wanting to use CouchDB as a document-oriented database:
|
94
94
|
class Document < CouchFoo::Base
|
95
95
|
property :number, Integer
|
96
96
|
property :street, String
|
data/VERSION.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: georgepalmer-couch_foo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- George Palmer
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-12 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|