   query: (cName, query, callback) ->
     return callback 'db already closed' if @closed
 
+    # Clone the query so we don't edit the original
+    query = shallowClone query
+    query.type = {$ne: null} unless query.type
+
     skip = query.$skip
-    #delete query.$skip
     limit = query.$limit
-    #delete query.$limit
 
     mongo.collection(cName).find query, (err, cursor) ->
       return callback err if err

# A super simple mongodb adapter for itsalive

# mongo is a mongoskin client. Create with:
#  mongo.db('localhost:27017/tx?auto_reconnect', safe:true)



  queryDoc: (cName, docName, query, callback) ->
    if query._id
      return callback() if query._id isnt docName
    else
      # Clone the query so we don't edit the original
      query = shallowClone query
      query._id = docName unless query._id

    mongo.collection(cName).findOne query, (err, result) ->
      if result
        result.docName = docName
