'use strict';

const utils = require( './utils.js' );

/* eslint no-unused-vars: 0 */

module.exports.search = function search( pathObj ) {
    // TODO: hit mongo and search

    return Promise.reject( 'NOT_IMPLEMENTED' );
};

module.exports.update = function update( pathObj, data ) {
    // TODO: hit mongo and update

    //

    return Promise.reject( 'NOT_IMPLEMENTED' );
};

module.exports.destroy = function destroy( pathObj ) {
    // TODO: hit mongo and delete

    return Promise.reject( 'NOT_IMPLEMENTED' );
};

@@ -12,19 +12,50 @@
 ';%0A%0A
+/* eslint no-unused-vars: 0 */%0A%0A
 const 
-utils
+File
  = r
@@ -68,22 +68,30 @@
 ( '.
-/utils
+./schemas/file
 .js' );%0A
 %0A/* 
@@ -90,40 +90,79 @@
  );%0A
-%0A/* eslint no-unused-vars: 0 */%0A
+const Meta = require( '../schemas/metadata.js' );%0A%0A// Insert a document
 %0Amod
@@ -173,22 +173,22 @@
 exports.
-search
+insert
  = funct
@@ -195,62 +195,202 @@
 ion 
-search( pathObj ) %7B%0A    // TODO: hit mongo and search%0A
+insert( toInsert ) %7B%0A    return Promise.reject( 'NOT_IMPLEMENTED' );%0A%7D;%0A%0A// Search for a document, with an optional sorting parameter%0Amodule.exports.search = function search( toMatch, toSort ) %7B
 %0A   
@@ -430,32 +430,64 @@
 EMENTED' );%0A%7D;%0A%0A
+// Update any matched documents%0A
 module.exports.u
@@ -515,21 +515,25 @@
 te( 
-pathObj, data
+toMatch, toUpdate
  ) %7B
@@ -541,46 +541,142 @@
     
-// TODO: hit mongo and update%0A%0A    //%0A
+return Promise.reject( 'NOT_IMPLEMENTED' );%0A%7D;%0A%0A// Delete any matched documents%0Amodule.exports.destroy = function destroy( toMatch ) %7B
 %0A   
@@ -724,16 +724,59 @@
  );%0A%7D;%0A%0A
+// Resolve a fullPath and userId to a GUID%0A
 module.e
@@ -774,39 +774,39 @@
 %0Amodule.exports.
-destroy
+getGUID
  = function dest
@@ -805,109 +805,714 @@
 ion 
-destroy( pathO
+getGUID( fullPath, userId ) %7B%0A    return new Promise(( resolve, reject ) =%3E %7B%0A        File.findOne(%7B $and: %5B%7B parent: fullPath %7D, %7B userId: userId %7D%5D%7D, ( err, o
 bj )
+ =%3E
  %7B%0A    
-// TODO: hit mongo and delete%0A%0A    return Promise.reject( 'NOT_IMPLEMENTED' 
+        if ( err ) %7B%0A                reject( 'INVALID_RESOURCE_PATH' );%0A            %7D%0A            else %7B%0A                resolve( obj.metaDataId );%0A            %7D%0A        %7D);%0A    %7D)%0A%0A    // Grab the metaData doc by the ID%0A    .then(( id ) =%3E %7B%0A        Meta.findOne(%7B _id: id %7D, ( err, obj ) =%3E %7B%0A            if ( err ) %7B%0A                throw new Error( 'INVALID_RESOURCE' );%0A            %7D%0A            return obj;%0A        %7D);%0A    %7D)%0A%0A    // Return null if there isn't an associated GUID%0A    .catch(( ) =%3E %7B%0A        return null;%0A    %7D
 );%0A%7D

Clean up mongo.js and add getGUID()