Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Useful when clearing results from tutor

  • Loading branch information...
commit 898001a2ac1dcc393fe56d8a3110e18ca76b3463 1 parent 32c9422
@mikeymckay mikeymckay authored
Showing with 24 additions and 1 deletion.
  1. +0 −1  Android-Couchbase-Callback
  2. +24 −0 scripts/clearResults.rb
1  Android-Couchbase-Callback
@@ -1 +0,0 @@
-Subproject commit fd28e96373c44b5a1b03828e26e917049e7efec1
View
24 scripts/clearResults.rb
@@ -0,0 +1,24 @@
+#!/usr/bin/ruby
+require 'rubygems'
+require 'couchrest'
+require 'cgi'
+require 'json'
+require 'net/http'
+require 'rest_client'
+require 'uri'
+
+@db = CouchRest.database("http://admin:password@localhost:5984/tangerine")
+
+docs = @db.view('tangerine/results', {:include_docs => true})['rows'].map do |result|
+ print "."
+ @db.delete_doc(result["doc"],true)
+end
+
+docs = @db.view('tangerine/tripsAndUsers', {:include_docs => true})['rows'].map do |result|
+ print "."
+ @db.delete_doc(result["doc"],true)
+end
+
+puts "Bulk deleting"
+@db.bulk_save()
+@db.compact!
Please sign in to comment.
Something went wrong with that request. Please try again.