-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/thejoonshow/Passy-By
- Loading branch information
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<lint> | ||
</lint> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package com.app.dev.dreamteam.passby; | ||
|
||
import java.net.UnknownHostException; | ||
import java.text.DateFormat; | ||
import java.text.SimpleDateFormat; | ||
import java.util.Date; | ||
import java.util.TimeZone; | ||
|
||
import com.mongodb.BasicDBObject; | ||
import com.mongodb.DB; | ||
import com.mongodb.DBCollection; | ||
import com.mongodb.MongoClient; | ||
import com.mongodb.MongoClientURI; | ||
|
||
public class Mongo { | ||
|
||
private String URI = "mongodb://heroku_app31185285:bq7pjcjnp9i0aaolc087u968hr@ds047950.mongolab.com:47950/heroku_app31185285"; | ||
private MongoClient mc; | ||
private DB db; | ||
|
||
public Mongo() { | ||
MongoClientURI uri = new MongoClientURI(URI); | ||
try { | ||
mc = new MongoClient(uri); | ||
} catch (UnknownHostException e) { | ||
// TODO Auto-generated catch block | ||
e.printStackTrace(); | ||
} | ||
db = mc.getDB("heroku_app31185285"); | ||
} | ||
|
||
public String test() { | ||
DBCollection coll = db.getCollection("visitor"); | ||
|
||
BasicDBObject doc = new BasicDBObject(); | ||
|
||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
df.setTimeZone(TimeZone.getTimeZone("America/New_York")); | ||
|
||
doc.append("ts", df.format(new Date())); | ||
coll.insert(doc); | ||
return "hello"; | ||
} | ||
} |