 		@
 
 	# Get a file by its selector
+	# TODO: What on earth is a selector?
 	getFileBySelector: (selector,opts={}) ->
 		opts.collection ?= @getDatabase()
 		file = opts.collection.get(@filesBySelector[selector])

	# ---------------------------------
	# Collection Helpers

	# Get Files (will use live collections)
	getFiles: (query,sorting,paging) ->
		key = JSON.stringify({query,sorting,paging})
		files = @getCollection(key)

			@setCollection(key, files)
		return files

	# Get a single file based on a query
	getFile: (query,sorting,paging) ->
		file = @getDatabase().findOne(query,sorting,paging)
		return file

	# Get files at a path
	getFilesAtPath: (path,sorting,paging) ->
		query = $or: [{relativePath: $startsWith: path}, {fullPath: $startsWith: path}]
		files = @getFiles(query,sorting,paging)
		return files

	# Get a file at a relative or absolute path or url
	getFileAtPath: (path,sorting,paging) ->
		file = @getDatabase().fuzzyFindOne(path,sorting,paging)
		return file

	# Get a file by its url
	# TODO: Does this still work???
	getFileByUrl: (url,opts={}) ->
		opts.collection ?= @getDatabase()
		file = opts.collection.get(@filesByUrl[url])
