Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (33 sloc) 0.84 kB

Using MongoHQ with pkgcloud

MongoHQ is available in pkgcloud as a pkgcloud.databases target. Here is an example of how to use it:

  var client = pkgcloud.database.createClient({
    provider: 'mongohq',
    username: "bob",
    password: "1234"
  });

  //
  // Create a MongoDB
  //
  client.create({
    name: "mongo-instance",
    plan: "free",
  }, function (err, result) {
    //
    // Check the result
    //
    console.log(err, result);

    //
    // Now delete that same MongoDB
    //
    client.remove(result.id, function (err, result) {
      //
      // Check the result
      //
      console.log(err, result);
    });
  });

The client instance returned by pkgcloud.database.createClient has the following methods for MongoHQ:

  • client.create(options, callback)
  • client.remove(id, callback)
Jump to Line
Something went wrong with that request. Please try again.