|
| 1 | + |
| 2 | +========================= |
| 3 | +Mongo AppEngine Connector |
| 4 | +========================= |
| 5 | +:Info: See `the mongo site <http://www.mongodb.org>`_ for more information. See `github <http://github.com/mongodb/mongo-appengine-connector/tree>`_ for the latest source. |
| 6 | +:Author: Mike Dirolf <mike@10gen.com> |
| 7 | + |
| 8 | +About |
| 9 | +===== |
| 10 | +The Mongo AppEngine Connectory provides a drop-in replacement for App Engine's |
| 11 | +datastore API, using MongoDB as a backend. |
| 12 | + |
| 13 | +Usage |
| 14 | +===== |
| 15 | +This adaptor has been tested against revision 41 from Google |
| 16 | +AppEngine's svn repository. The following patch (generated by `svn |
| 17 | +diff`) shows how to modify the AppEngine code in order to use MongoDB:: |
| 18 | + |
| 19 | +> Index: dev_appserver.py |
| 20 | +> =================================================================== |
| 21 | +> --- dev_appserver.py (revision 41) |
| 22 | +> +++ dev_appserver.py (working copy) |
| 23 | +> @@ -37,6 +37,7 @@ |
| 24 | +> SCRIPT_DIR = os.path.join(DIR_PATH, 'google', 'appengine', 'tools') |
| 25 | +> |
| 26 | +> EXTRA_PATHS = [ |
| 27 | +> + "PATH/TO/MONGO-APPENGINE-CONNECTOR/DIRECTORY", |
| 28 | +> DIR_PATH, |
| 29 | +> os.path.join(DIR_PATH, 'lib', 'antlr3'), |
| 30 | +> os.path.join(DIR_PATH, 'lib', 'django'), |
| 31 | +> Index: google/appengine/tools/dev_appserver.py |
| 32 | +> =================================================================== |
| 33 | +> --- google/appengine/tools/dev_appserver.py (revision 41) |
| 34 | +> +++ google/appengine/tools/dev_appserver.py (working copy) |
| 35 | +> @@ -75,7 +75,7 @@ |
| 36 | +> from google.appengine.api import apiproxy_stub_map |
| 37 | +> from google.appengine.api import appinfo |
| 38 | +> from google.appengine.api import datastore_admin |
| 39 | +> -from google.appengine.api import datastore_file_stub |
| 40 | +> +import datastore_mongo_stub |
| 41 | +> from google.appengine.api import mail_stub |
| 42 | +> from google.appengine.api import urlfetch_stub |
| 43 | +> from google.appengine.api import user_service_stub |
| 44 | +> @@ -3001,7 +3001,7 @@ |
| 45 | +> |
| 46 | +> apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap() |
| 47 | +> |
| 48 | +> - datastore = datastore_file_stub.DatastoreFileStub( |
| 49 | +> + datastore = datastore_mongo_stub.DatastoreMongoStub( |
| 50 | +> app_id, datastore_path, history_path, require_indexes=require_indexes) |
| 51 | +> apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore) |
| 52 | + |
| 53 | +The path added to *dev_appserver.py* should be replaced with the path |
| 54 | +where this directory is located on your machine. This patch should then be |
| 55 | +applied against a clean version of the AppEngine svn repository. |
| 56 | + |
| 57 | +Other Notes |
| 58 | +=========== |
| 59 | +You must have a copy of the `PyMongo distribution <http://pypi.python.org/pypi/pymongo/>`_ |
| 60 | +installed in order to use the AppEngine Connector. |
| 61 | + |
| 62 | +Right now, the Connection cannot be configured. It attempts to |
| 63 | +connect to a standalone MongoDB instance on localhost:27017. |
| 64 | + |
| 65 | +Transactions are unsupported. When any operation requiring |
| 66 | +transactions is performed a warning will be logged and the operation |
| 67 | +will be performed transaction-less. |
| 68 | + |
| 69 | +DateTime values get rounded to the nearest millisecond when saved to |
| 70 | +MongoDB. This is a limitation of MongoDB's date representation, and is |
| 71 | +not specific to this adaptor. |
| 72 | + |
| 73 | +In order to actually create indexes the dev_appserver must be run with |
| 74 | +the --require-indexes option. Running with this option will probably |
| 75 | +add significant overhead, since each time the dev_appserver checks to |
| 76 | +see if it should create an index a query is performed. |
| 77 | + |
| 78 | +Index creation ignores the "Ancestor" option. This option would just create an |
| 79 | +index on '_id', which (soon) MongoDB creates automatically anyway. |
0 commit comments