       callback null, []
       return
 
-    client.collection 'ops', (err, collection) ->
+    client.collection opsCollectionForDoc(docName), (err, collection) ->
       return callback? err if err
       
       query = 
-        docName: docName
-        v:
+        _id:
           $gte: start
-      query.v.$lt = end if end
+      query._id.$lt = end if end
       
-      collection.find(query).sort('v').toArray (err, docs) ->
+      collection.find(query).sort('_id').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 'ops', (err, collection) ->
      return callback? err if err
      
      doc = 
        docName: docName
        opData:
          op: opData.op
          meta: opData.meta
        v: opData.v
      
      collection.insert doc, safe: true, (err, doc) ->
        console.warn "failed to save op #{opData} for #{docName}: #{err}" if err

        
  # Permanently deletes a document. There is no undo.
  @delete = (docName, dbMeta, callback) ->
    client.collection opsCollectionForDoc(docName), (err, collection) ->
      collection.drop()

    client.collection 'docs', (err, collection) ->
      return callback? err if err
