File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ namespace Robomongo
2727 std::string dbname () const { return _scriptInfo.dbname (); }
2828 const CursorPosition &cursor () const { return _scriptInfo.cursor (); }
2929 void setScript (const QString &script) { return _scriptInfo.setScript (script); }
30+ void setScriptExecutable (bool execute) { return _scriptInfo.setExecutable (execute); }
3031 void setAggrInfo (AggrInfo const & aggrInfo) { _aggrInfo = aggrInfo; }
3132 QString filePath () const { return _scriptInfo.filePath (); }
3233
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ namespace Robomongo
1414 const QString &title = QString(), const QString &filePath = QString());
1515
1616 bool execute () const { return _execute; }
17+ void setExecutable (bool execute) { _execute = execute; }
1718 QString script () const { return _script; }
1819 std::string dbname () const { return _dbname; }
1920 const QString &title () const { return _title; }
@@ -28,7 +29,7 @@ namespace Robomongo
2829 private:
2930 QString _script;
3031 std::string _dbname;
31- const bool _execute;
32+ bool _execute;
3233 const QString _title;
3334 const CursorPosition _cursor;
3435 QString _filePath;
Original file line number Diff line number Diff line change @@ -183,14 +183,17 @@ namespace Robomongo
183183 info._skip = skip;
184184 info._batchSize = batchSize;
185185 _outputWidget->showProgress ();
186-
186+
187+ _shell->setScriptExecutable (true );
187188 if (_aggrInfo.isValid ) {
188189 // Build original pipeline object, and append extra skip and limit for paging
189190 std::string pipelineModified = " [" ;
190- int i = 0 ;
191- while (!_aggrInfo.pipeline .getObjectField (std::to_string (i)).isEmpty ()) {
192- pipelineModified.append (_aggrInfo.pipeline .getObjectField (std::to_string (i)).toString () + " ," );
193- ++i;
191+ for (int i = 0 ; ; i++) {
192+ auto const obj = mongo::tojson (_aggrInfo.pipeline .getObjectField (std::to_string (i)));
193+ if (obj.empty () || " {}" == obj)
194+ break ;
195+
196+ pipelineModified.append (obj + " ," );
194197 }
195198 pipelineModified.append (" {$skip:" + std::to_string (skip) + " }, " +
196199 " {$limit:" + std::to_string (batchSize) + " }" +
You can’t perform that action at this time.
0 commit comments