replaced db.query with db.documents.query