 
   client = new mongodb.Db(options.db, new mongodb.Server(options.hostname, options.port, options.mongoOptions))
 
-  client.ensureIndex 'ops', {docName: 1, v: 1}, {unique: true}, (err, name) ->
-    console.warn "failed to ensure mongo index on ops collection: #{err}\nperformance may suffer" if err
+  opsCollectionForDoc = (docName) -> 'ops.'+docName.replace /$/g, ''  # $ is reserved in collection names.
 
   # Creates a new document.
   # data = {snapshot, type:typename, [meta]}

      callback null, []
      return

    client.collection 'ops', (err, collection) ->
      return callback? err if err
      
      query = 
        docName: docName
        v:
          $gte: start
      query.v.$lt = end if end
      
      collection.find(query).sort('v').toArray (err, docs) ->
        console.warn "failed to get ops for #{docName}: #{err}" if err
        return callback? err if err


  # ... and that would slow it down a bit.)
  @writeOp = (docName, opData, callback) ->
    # ****** NOT SAFE FOR MULTIPLE PROCESSES. Rewrite me using transactions or something.
    client.collection opsCollectionForDoc(docName), (err, collection) ->
      return callback? err if err
      
      doc = 
        _id: opData.v
        opData:
          op: opData.op
          meta: opData.meta
      
      collection.insert doc, safe: true, (err, doc) ->
        console.warn "failed to save op #{opData} for #{docName}: #{err}" if err
