SBT MongoDB Task


/ Published in: Scala
Save to your folder(s)



Copy this code and paste it in your HTML
  1. lazy val mongoRefresh = task {
  2.  
  3. log.info("Refreshing Mongo Database")
  4.  
  5. val sudo = new Mongo("localhost").getDB("sudo")
  6.  
  7. sudo.dropDatabase
  8.  
  9. val domains = new BasicDBList()
  10.  
  11. domains.add("localhost")
  12.  
  13. val devHost = BasicDBObjectBuilder.start("name", "dev")
  14. .add("domains", domains).get
  15.  
  16. sudo.getCollection("hosts").save(devHost)
  17.  
  18. None
  19. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.