Guest User

Untitled

a guest
May 27th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Ledger.prototype.find_all = function(callback) {
  2. this.collection(function(err, collection) {
  3. collection.find(function(err, cursor) {
  4. cursor.toArray(function(err, docs) {
  5. callback.apply(this,[err,docs]);
  6. });
  7. });
  8. });
  9. };
  10. # Same problems with this write of it
  11. #
  12. Ledger.prototype.find_all = function(callback) {
  13. this.collection(function(err, collection, client) {
  14. raise_if(err);
  15. collection.find(function(err, cursor) {
  16. raise_if(err);
  17. docs = []
  18. cursor.each(function(err, doc) {
  19. raise_if(err);
  20. docs[docs.length] = doc
  21. });
  22. callback.apply(this,[err,docs]);
  23. client.close();
  24. });
  25. });
  26. };
Add Comment
Please, Sign In to add comment