Fixed bug in query projection
This commit is contained in:
1 parent
35e2aad4b3
commit
a22e638e9a
1 file changed
+4
-1
+4
-1
@@ -84,12 +84,15 @@ projection = (query, proj) ->
|
|||||||
optimizeProjection = (obj) ->
|
optimizeProjection = (obj) ->
|
||||||
keys = Object.keys(obj).sort()
|
keys = Object.keys(obj).sort()
|
||||||
return if keys.length <= 1
|
return if keys.length <= 1
|
||||||
for i in [1 ... keys.length]
|
i = 1
|
||||||
|
while i < keys.length
|
||||||
a = keys[i-1]
|
a = keys[i-1]
|
||||||
b = keys[i]
|
b = keys[i]
|
||||||
if common.startsWith(b, a)
|
if common.startsWith(b, a)
|
||||||
if b.charAt(a.length) == '.' or b.charAt(a.length - 1) == '.'
|
if b.charAt(a.length) == '.' or b.charAt(a.length - 1) == '.'
|
||||||
delete obj[b]
|
delete obj[b]
|
||||||
|
keys.splice(i--, 1)
|
||||||
|
++ i
|
||||||
|
|
||||||
|
|
||||||
exports.test = test
|
exports.test = test
|
||||||
|
|||||||
Reference in new issue
Block a user