11// deno-lint-ignore-file no-unused-vars
22import { crocks , R } from "./deps.js" ;
3- import { formatDocs , queryOptions , xId } from "./utils.js" ;
3+ import { formatDocs , queryOptions } from "./utils.js" ;
44
55const { Async, tryCatch, resultToAsync } = crocks ;
66const {
@@ -15,8 +15,6 @@ const {
1515 pluck,
1616 set,
1717 split,
18- over,
19- identity,
2018} = R ;
2119const cmd = ( n ) => ( db ) => Async . fromPromise ( db [ n ] . bind ( db ) ) ;
2220
@@ -145,8 +143,8 @@ export function adapter(client) {
145143 )
146144 . chain ( ( db ) =>
147145 insertOne ( db ) ( {
148- _id : id ,
149146 ...doc ,
147+ _id : id ,
150148 } )
151149 . bimap (
152150 ( e ) => ( { ok : false , status : 409 , id, msg : e . message } ) ,
@@ -174,7 +172,6 @@ export function adapter(client) {
174172 ? Async . Resolved ( doc )
175173 : Async . Rejected ( { ok : false , status : 404 , msg : "Not Found!" } )
176174 )
177- . map ( over ( xId , identity ) )
178175 . toPromise ( ) ;
179176 }
180177
@@ -232,7 +229,7 @@ export function adapter(client) {
232229 ...queryOptions ( query ) ,
233230 noCursorTimeout : undefined ,
234231 } ) . toArray ( ) ;
235- return { ok : true , docs : map ( over ( xId , identity ) , docs ) } ;
232+ return { ok : true , docs } ;
236233 } catch ( e ) {
237234 console . log ( e ) ;
238235 return { ok : false , msg : e . message } ;
@@ -297,7 +294,7 @@ export function adapter(client) {
297294 noCursorTimeout : undefined ,
298295 } ) . toArray ( ) ;
299296
300- return { ok : true , docs : map ( over ( xId , identity ) , docs ) } ;
297+ return { ok : true , docs } ;
301298 } catch ( e ) {
302299 console . log ( "ERROR: " , e . message ) ;
303300 return { ok : false , msg : e . message } ;
@@ -333,7 +330,7 @@ export function adapter(client) {
333330 ( _ ) => ( {
334331 ok : true ,
335332 results : map (
336- ( d ) => ( { ok : true , id : d . id || d . _id , _id : d . _id } ) ,
333+ ( d ) => ( { ok : true , id : d . _id } ) ,
337334 docs ,
338335 ) ,
339336 } ) ,
0 commit comments