How to use the mingo.setup function in mingo

To help you get started, we’ve selected a few mingo 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 Stellarium / stellarium-web-engine / web-frontend / src / assets / noctuasky-client.js View on Github external
// Stellarium Web - Copyright (c) 2018 - Noctua Software Ltd
//
// This program is licensed under the terms of the GNU AGPL v3, or
// alternatively under a commercial licence.
//
// The terms of the AGPL v3 license can be found in the main directory of this
// repository.

import Swagger from 'swagger-client'
import _ from 'lodash'
import store from 'store'
import mingo from 'mingo'

mingo.setup({key: 'id'})

var swaggerClient
var localIdCounter = 0

var generateLocalId = function () {
  localIdCounter++
  return 'local_' + localIdCounter
}

var equipments = [
  {
    id: 'none'
  },
  {
    id: 'base',
    schema: [
github sean-ww / react-redux-datatable / .storybook / mocks / api / search.js View on Github external
const search = (searchData, params) => {
  const tableSettings = JSON.parse(params.get('tableSettings'));
  const limit = params.get('limit');
  const offset = params.get('offset');
  const searchValue = params.get('searchValue');
  const columnFilters = JSON.parse(params.get('columnFilters'));

  mingo.setup({
    key: tableSettings.keyField
  });

  const searchableColumns = tableSettings.tableColumns
    .filter(column => column.searchable !== false)
    .map(column => column.key);
  const searchValueQuery = generateSearchValueQuery(searchValue, searchableColumns);
  const filterQuery = generateFilterQuery(columnFilters);
  const sortOptions = generateSortOptions(tableSettings, params);
  const query = {...searchValueQuery, ...filterQuery};

  const dataTotalSize = mingo
    .find(searchData.data, query)
    .count();

  const data = mingo
github serby / save / lib / memory-engine.js View on Github external
module.exports = function(opts) {
  var options = Object.assign({ idProperty: '_id' }, opts)
  var self = es.map(createOrUpdate)
  var data = []
  var idSeq = 0

  Mingo.setup({ key: options.idProperty })

  function findById(id) {
    var query = {}
    query[options.idProperty] = id
    return Mingo.find(data, query).first()
  }

  /**
   * Checks that the object has the ID property present, then checks
   * if the data object has that ID value present.e
   *
   * Returns an Error to the callback if either of the above checks fail
   *
   * @param {Object} object to check
   * @param {Function} callback
   * @api private
github amelisa / amelisa / src / mongo / MongoQueries.js View on Github external
import Mingo from 'mingo'

Mingo.setup({
  key: '_id'
})

const metaOperators = {
  $comment: true,
  $explain: true,
  $hint: true,
  $limit: true,
  $maxScan: true,
  $max: true,
  $min: true,
  $orderby: true,
  $returnKey: true,
  $showDiskLoc: true,
  $skip: true,
  $snapshot: true,

mingo

MongoDB query language for in-memory objects

MIT
Latest version published 7 days ago

Package Health Score

83 / 100
Full package analysis