1.0.3 • Published 10 months ago

emquery v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
10 months ago

emquery

Build Status NPM

Construct a mongodb query update for embedded documents.

Works great with mongoose.

install

  $ npm install emquery

example

  $ node example.js
  const emquery = require('emquery');

  const UserModel = require('../models/user');

  app.put('/users/:id', function updateUser(req, res, next) {
    const updates = {
      $set: emquery(req.body);
    };

    User.findByIdAndUpdate(user._id, updates, function(err, user) {
      if(err) return next(err);
      res.json(user);
    });
  });

API

emquery({}#object} = require('emquery')

Pass in the object to parsed to a query.

license

MIT

1.0.3

10 months ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago