@@ -1751,6 +1751,11 @@ var pluginManager = function pluginManager() {
1751
1751
logDbRead . d ( "aggregate " + collection + " %j %j" + at , query , options ) ;
1752
1752
logDbRead . d ( "From connection %j" , countlyDb . _cly_debug ) ;
1753
1753
var cursor = this . _aggregate ( query , options ) ;
1754
+ cursor . _count = cursor . count ;
1755
+ cursor . count = function ( ) {
1756
+ arguments . unshift ( query ) ;
1757
+ return ob . countDocuments . apply ( ob , arguments ) ;
1758
+ } ;
1754
1759
cursor . _toArray = cursor . toArray ;
1755
1760
cursor . toArray = function ( cb ) {
1756
1761
return handlePromiseErrors ( cursor . _toArray ( logForReads ( cb , e , copyArguments ( args , "aggregate" ) ) ) , e , copyArguments ( arguments , "aggregate" ) ) ;
@@ -1796,6 +1801,11 @@ var pluginManager = function pluginManager() {
1796
1801
logDbRead . d ( "find " + collection + " %j %j" + at , query , options ) ;
1797
1802
logDbRead . d ( "From connection %j" , countlyDb . _cly_debug ) ;
1798
1803
var cursor = this . _find ( query , options ) ;
1804
+ cursor . _count = cursor . count ;
1805
+ cursor . count = function ( ) {
1806
+ arguments . unshift ( query ) ;
1807
+ return ob . countDocuments . apply ( ob , arguments ) ;
1808
+ } ;
1799
1809
cursor . _toArray = cursor . toArray ;
1800
1810
cursor . toArray = function ( callback ) {
1801
1811
return handlePromiseErrors ( cursor . _toArray ( logForReads ( callback , e , copyArguments ( args , "find" ) ) ) , e , copyArguments ( arguments , "find" ) ) ;
0 commit comments