Giter VIP home page Giter VIP logo

minq's Issues

generic defer/thunk

Rather than implementing, eg, Query#deferOne for each finalizer, have a Query#defer() function which alters the behavior of the finalizers.

Pipelining

Eg byId -> byIds rewrite
Experiment
Hinting? Automatic?

publish v1.1.0 to npm

@jden i upgraded the underlying mongo driver to the last stable 1.x version; can you check it out and if it looks good pub to npm.

caching

add a Query#cache() method to trigger use of a caching plugin, if available.

can use in conjunction with Query#byId and Query#byIds. Possibly formalize this in a post-processing step so other chained custom query functions can use it.

cache plugin should have interface:{
get:
put: or set: (support either, prefer put)
del:
}

forEach, when used in a script, throws "Object #<Object> has no method 'forEach'"

using minq 1, rc 8; ubuntu 14.04; node 0.10.26; npm 1.4.3

setup

var connstr = process.env.DB_CONN_STRING;
var minq = require('minq');

minq.connect(connstr).then(function (db) {
  console.log('connected: ' + connstr);

  return db
    .from('CollectionName')
    .forEach(function (data) {
       console.log(data);
    });
})
.then(function () {
  console.log('done');
});

expected

a log of each item in the collection

> {}
> {}
...

actual

TypeError: Object #<Object> has no method 'forEach'
    at /home/test.js:23:15
    at Writable.stream._write (/home/node_modules/minq/node_modules/charybdis/index.js:51:14)
    at doWrite (_stream_writable.js:226:10)
    at writeOrBuffer (_stream_writable.js:216:5)
    at Writable.write (_stream_writable.js:183:11)
    at Stream.ondata (stream.js:51:26)
    at Stream.EventEmitter.emit (events.js:95:17)
    at drain (/home/node_modules/minq/node_modules/through/index.js:36:16)
    at Stream.stream.queue.stream.push (/home/node_modules/minq/node_modules/through/index.js:45:5)
    at Stream.<anonymous> (/home/node_modules/minq/mongodb.js:85:50)

notes

interestingly, if you add a select(['_id']) it works fine; however if you add any other element to the select, it fails with the same error

expect

add a Query#expect method to throw a NotFoundError if the actual number of documents returned is less than the number expected.

If used in conjunction with Query#byIds, Query#byId, Query#one, and Query#deferredOne, default to the appropriate number.

Current behavior is it will return null or an empty array.

fix collection names when db name contains non alpha characters

getCollectionNames should return an array of strings with collection names, not including the db name. if the db name contains, eg, a -, the collection name is returned including the db name, eg:

['test-db.foos','test-db.bars'] should be ['foos','bars']

Make lazy

Return Query instances which are lazy promises, to allow returning partial queries which can be further modified, restricted, etc.

Add Query#clone() method

Callable any time before the query is finalized,, create a new Query object with the same parameters (db, collection, query, options, etc)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.