These are chat archives for Automattic/mongoose

26th
Nov 2015
James Lee
@uptownhr
Nov 26 2015 01:23
hello
Maksim
@chetverikov
Nov 26 2015 01:24
hello )
Diego Aguilar Aguilar
@diegoaguilar
Nov 26 2015 23:31
I use Mongoose with bluebird promises
I'm trying this:
  var pattern = new RegExp(request.query.pattern, 'ig');
  Item.find('name', pattern).execAsync()
    .then(function (items) {
      return response.json(items);
    })
    .err(function (err) {
      return response.status(500).json(err);
    });
where item is a schema defined with a promisied mongoose instance
it's failing complaining execAsync does not exists
TypeError: Item.where(...).execAsync(...).then(...).err is not a function
    at findItemByRegex (/storage/dev/playground/tianguis/api/controllers/api/item.controller.js:21:6)
    at Layer.handle [as handle_request] (/storage/dev/playground/tianguis/node_modules/express/lib/router/layer.js:95:5)
    at next (/storage/dev/playground/tianguis/node_modules/express/lib/router/route.js:131:13)
    at Route.dispatch (/storage/dev/playground/tianguis/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/storage/dev/playground/tianguis/node_modules/express/lib/router/layer.js:95:5)
    at /storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:277:22
    at Function.process_params (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:330:12)
    at next (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:271:10)
    at Function.handle (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:176:3)
    at router (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/storage/dev/playground/tianguis/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:312:13)
    at /storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:280:7
    at Function.process_params (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:330:12)
    at next (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:271:10)
    at /storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:618:15
    at next (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:256:14)
    at Function.handle (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:176:3)
    at router (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:46:12)
    at Layer.handle [as handle_request] (/storage/dev/playground/tianguis/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:312:13)
    at /storage/dev/playground/tianguis/node_modules/express/lib/router/index.js:280:7