20

I'm trying to deploy one of my java apps in GAE and I have used MongoDB. Unfortunately GAE doesn't allow me to create databases, however it suggests using Google Datastore. Are there any plugins or add-ons to use MongoDB.

David Newcomb
  • 10,639
  • 3
  • 49
  • 62
prassee
  • 3,651
  • 6
  • 30
  • 49

7 Answers7

19

You can't run MongoDB on GAE. You need to use the Google datastore.

Matt Williamson
  • 39,165
  • 10
  • 64
  • 72
  • 2
    I thought that this was because GAE won't allow you to make HTTP calls, but evidently you can use the `requests` module. Why doesn't this work? – brandones Aug 29 '15 at 19:52
6

If you really want to use MongoDB anyway, you'll have to find a third-party host that provides a REST interface through which you can make your transactions. I've personally tried and recommend MongoLab on App Engine. Then, in your code, use an HttpUrlConnection object to send/receive requests if you're doing it with Java.

Matthew Quiros
  • 13,385
  • 12
  • 87
  • 132
  • how was the performance of GAE connecting to Mongolab (which I assume was running on AWS)? – ohadpr Aug 27 '13 at 21:27
  • @Matt : Can you please share some details over the benefits ? – dev Oct 11 '13 at 05:43
  • ^I was doing it for a very small side project, actually, just to explore MongoDB. I didn't do any benchmarks. – Matthew Quiros Dec 09 '13 at 08:03
  • I just managed to do this today - I'm connecting an android app to google app engine and then from there to mongolab. I timed from when I clicked the button on my android app to submit data to google app engine and then to mongolab to the time when I received a response back from mongolab - google app engine - android. The total time was 3 seconds. – Simon Dec 13 '14 at 10:34
  • And if anyone is interested, if I use the api explorer to send the request through to mongolab, the total time to send the request and then to return the 200 status OK HTTP code was about 850ms. That is once an instance of my GAE has spun up. If this was the very first request before my instance has spun up, the time was about 4-5 seconds. – Simon Dec 13 '14 at 13:51
  • As well, it seems that MongoLab is supported on GCE, so you do the whole thing within your google cloud project. I haven't tried it myself, but see here: https://mongolab.com/lp/mongodb-on-google/ – Tom Apr 17 '15 at 18:20
6

I think you could deploy your app on app engine and create a separate vm instance in google compute engine that would have mongo installed, then you plug your GAE app on that vm for the db connection. This would allow you to keep all your app in the google cloud. See https://cloud.google.com/solutions/mongodb/ and http://docs.mongodb.org/ecosystem/platforms/google-compute-engine/

eloone
  • 4,248
  • 2
  • 32
  • 35
6

Matt is right. If you want to deploy to Google's servers you can't use Mongo. If you are interesting in running your own server(s), check out AppScale.

Robert Kluin
  • 8,282
  • 25
  • 21
  • Cloud Foundry is another cloud platform with MongoDB support: http://www.mongodb.org/display/DOCS/VMware+CloudFoundry – Pau Giner Dec 13 '11 at 20:58
  • A more complete answer would be that Google suggest: "There are multiple options for creating a new MongoDB database. For example: * Create a Google Compute Engine virtual machine with MongoDB pre-installed. * Use mLab to create a free MongoDB deployment on Google Cloud Platform." https://cloud.google.com/nodejs/resources/databases/mongodb So you can run your app in GAE and your mongodb on GCA, or one of their managed solutions: https://cloud.google.com/nodejs/getting-started/using-structured-data Just needs to be in the same project so they share the same internal IP/network. – Sebastian Thomas Apr 25 '17 at 08:19
1

A lot of things have changed since this question has been asked, as of June 2021, you can use MongoDB Atlas with Google App Engine Standard running on Java 8 environment. I built my App with the Ktor framework that runs on App Engine and interacts with databases on MongoDB Atlas.

Anudeep Ananth
  • 955
  • 1
  • 8
  • 30
0

you can use mongo, only if have something like on mongolab then use pymongo to connect and most important thing you need to enable socket api from gae dashboard. it worked for me thanks

Rizwan Patel
  • 538
  • 2
  • 9
  • 27
0

if you're still looking for an answer to this you might want to check this project that did exactly the same but in reverse, it will surely help you out with what you want to do.

http://code.google.com/appengine/articles/django-nonrel.html

holografix
  • 610
  • 3
  • 10
  • 24