From 3fdd8c3f7abf868fe757b87af72be4a33ff20487 Mon Sep 17 00:00:00 2001 From: Mike Dirolf Date: Tue, 23 Mar 2010 14:35:50 -0400 Subject: [PATCH] doc: option is pk not pk_factory (although pk_factory is probably a better name) --- README.rdoc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.rdoc b/README.rdoc index 41a5e73..b6d1334 100644 --- a/README.rdoc +++ b/README.rdoc @@ -192,19 +192,19 @@ generate _id values. If you want to control _id values or even their types, using a PK factory lets you do so. You can tell the Ruby Mongo driver how to create primary keys by passing in -the :pk_factory option to the Connection#db method. +the :pk option to the Connection#db method. - db = Mongo::Connection.new.db('dbname', :pk_factory => MyPKFactory.new) + db = Mongo::Connection.new.db('dbname', :pk => MyPKFactory.new) -A primary key factory object must respond to :create_pk, which should take a -hash and return a hash which merges the original hash with any primary key -fields the factory wishes to inject. +A primary key factory object must respond to :create_pk, which should +take a hash and return a hash which merges the original hash with any +primary key fields the factory wishes to inject. -NOTE: if the object already has a primary key, the factory should not inject -a new key; this means that the object may already exist in the database. -The idea here is that whenever a record is inserted, -the :pk_factory object's +create_pk+ method will be called and -the new hash returned will be inserted. +NOTE: if the object already has a primary key, the factory should not +inject a new key; this means that the object may already exist in the +database. The idea here is that whenever a record is inserted, the +:pk object's +create_pk+ method will be called and the new hash +returned will be inserted. Here is a sample primary key factory, taken from the tests: