File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,10 @@ class DocumentIndex {
5
5
this . _index = { }
6
6
}
7
7
8
- get ( key ) {
9
- return this . _index [ key ]
8
+ get ( key , fullOp = false ) {
9
+ return fullOp
10
+ ? this . _index [ key ]
11
+ : this . _index [ key ] . payload . value
10
12
}
11
13
12
14
updateIndex ( oplog , onProgressCallback ) {
@@ -16,7 +18,7 @@ class DocumentIndex {
16
18
// handled.push(item.payload.key)
17
19
handled [ item . payload . key ] = true
18
20
if ( item . payload . op === 'PUT' ) {
19
- this . _index [ item . payload . key ] = item . payload . value
21
+ this . _index [ item . payload . key ] = item
20
22
} else if ( item . payload . op === 'DEL' ) {
21
23
delete this . _index [ item . payload . key ]
22
24
}
Original file line number Diff line number Diff line change @@ -37,9 +37,12 @@ class DocumentStore extends Store {
37
37
. map ( mapper )
38
38
}
39
39
40
- query ( mapper ) {
40
+ query ( mapper , options = { } ) {
41
+ // Whether we return the full operation data or just the db value
42
+ const fullOp = options ? options . fullOp : false
43
+
41
44
return Object . keys ( this . _index . _index )
42
- . map ( ( e ) => this . _index . get ( e ) )
45
+ . map ( ( e ) => this . _index . get ( e , fullOp ) )
43
46
. filter ( ( e ) => mapper ( e ) )
44
47
}
45
48
You can’t perform that action at this time.
0 commit comments