How to use the mongodb-extended-json.deserialize function in mongodb-extended-json

To help you get started, we’ve selected a few mongodb-extended-json examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.replace(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID
      req.query = deserialize(req.query)

      store.replace(req, deserialize(req.data), cb)
    })
github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.updateById(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID

      store.updateById(req, deserialize(req.data), (err, result) => {
        if (err) {
          cb(err)
        } else {
          cb(null, preResponseHandler(result))
        }
      })
    })
github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.update(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID
      req.query = deserialize(req.query)

      store.update(req, deserialize(req.data), (err, result) => {
        if (err) {
          cb(err)
        } else {
          cb(null, preResponseHandler(result))
        }
      })
    })
github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.create(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID
      req.data = deserialize(req.data)

      store.create(req, cb)
    })
github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.update(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID
      req.query = deserialize(req.query)

      store.update(req, deserialize(req.data), (err, result) => {
        if (err) {
          cb(err)
        } else {
          cb(null, preResponseHandler(result))
        }
      })
    })
github vkarpov15 / dookie / index.js View on Github external
let promises = [];
    for (const collection in data) {
      let docs = data[collection];
      if (docs.length === 0) {
        continue;
      }
      for (let i = 0; i < docs.length; ++i) {
        const doc = docs[i];
        expand(extensions, doc);
        const tmp = doc.$set;
        delete doc.$set;
        for (const key in tmp) {
          dot.set(doc, key, tmp[key]);
        }

        docs[i] = ejson.deserialize(doc);
      }
      promises.push(db.collection(collection).insert(docs));
    }
    if (get(options, 'clearConnection', null)) {
      yield db.close();
    }
    const res = yield promises;
    return res;
  });
}
github hemerajs / hemera / packages / hemera-mongo-store / index.js View on Github external
hemera.add(StorePattern.replaceById(topic), function(req, cb) {
      const collection = db.collection(req.collection)
      const store = new MongoStore(collection, opts)
      store.ObjectID = ObjectID

      store.replaceById(req, deserialize(req.data), (err, result) => {
        if (err) {
          cb(err)
        } else {
          cb(null, preResponseHandler(result))
        }
      })
    })