| 166 | } // end of GetCollSize |
| 167 | |
| 168 | public boolean FindColl(String query, String fields) { |
| 169 | if (DEBUG) |
| 170 | System.out.println("FindColl: query=" + query + " fields=" + fields); |
| 171 | |
| 172 | try { |
| 173 | if (query != null) { |
| 174 | Bson dbq = Document.parse(query); |
| 175 | finditer = coll.find(dbq); |
| 176 | } else |
| 177 | finditer = coll.find(); |
| 178 | |
| 179 | if (fields != null) { |
| 180 | Bson dbf = BsonDocument.parse(fields); |
| 181 | finditer = finditer.projection(dbf); |
| 182 | } // endif fields |
| 183 | |
| 184 | cursor = finditer.iterator(); |
| 185 | } catch (Exception e) { |
| 186 | SetErrmsg(e); |
| 187 | return true; |
| 188 | } // end try/catch |
| 189 | |
| 190 | return false; |
| 191 | } // end of FindColl |
| 192 | |
| 193 | @SuppressWarnings("unchecked") |
| 194 | public boolean AggregateColl(String pipeline) { |