Created
December 8, 2011 15:37
-
-
Save JanPaulEttles/1447332 to your computer and use it in GitHub Desktop.
consistentstructure #1
This file contains hidden or 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
| public class TestDBObjectFactory { | |
| public static DBObject createJson() { | |
| DBObject doc = new BasicDBObject(); | |
| doc.put("_id", "someGeneratedValue"); | |
| doc.put("nameOne", "valueOne"); | |
| doc.put("nameTwo", "valueTwo"); | |
| DBObject sub = new BasicDBObject(); | |
| sub.put("subNameOne", "subValueOne"); | |
| sub.put("subNameTwo", "subValueTwo"); | |
| doc.put("sub", sub); | |
| ArrayList array = new ArrayList(); | |
| array.add(new BasicDBObject("arraySubNameOne", "arraySubValueOne")); | |
| array.add(new BasicDBObject("arraySubNameTwo", "arraySubValueTwo")); | |
| doc.put("array", array); | |
| return doc; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment