Code Monkey home page Code Monkey logo

mongoose-troop's People

Contributors

jeduan avatar proful avatar sorensen avatar tblobaum avatar wdulin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mongoose-troop's Issues

slug - Autoincrement in duplicate titles

Hi, great collection of plugins.
Any chance to add this feature to the slug plugin ?
Something like:

a = new Post({title:'hello world'});
b = new Post({title:'hello world'});
// save a and b
a.slug == 'hello-world';
b.slug == 'hello-world-1';

thanks!

Created Field not created...

The modified field gets on just fine, but the created field doesn't get attached to any of the schemas I'm using the plugin for... I've tried providing a createdPath, and that didn't make a difference. The weird thing is when I print out the schema immediately after calling .plugin it shows the created field in the schema, however, none of the objects in my database have acreated field, just a modified field. Am I missing something here?

This is how I'm using it: schema.plugin(troop.timestamp); where schema is one of my mongoose schemas. That's the right way to do it right?

Module doesn't work on windows (path problems in directory)

I am unable to use the library on windows.
The following error occurs:
TypeError: Cannot call method 'split' of undefined
at node_modules\mongoose-troop\node_modules\directory\lib\directory.js:23:45
at Array.forEach (native)
at modulate (node_modules\mongoose-troop\node_modules\directory\lib\directory.js:21:9)
at Object. (node_modules\mongoose-troop\index.js:8:21)

looks like when you try to require all the nested indexes under lib, you pass __dirname + /lib/ to the directory module, which eventually tries to split:
node_modules\mongoose-troop\lib\acl.js
with:
node_modules\mongoose-troop/lib/

obviously failing.

Docs/Tests

Just a little prod to try encourage you to fill out the docs and tests more.

created field is not created

Hello I try to use the timestamp plugin but only modified field is created the created time field is not... any idea?

Increment Bcrypt Version

I'd like to suggest either incrementing the Bcrypt library version so that it is compatible with io.js or switching to Bcryptjs which is also compatible with io.js.

Doesn't work on Windows

I'm trying to install this library onto my Windows machine, but when I do, it fails when attempting to install and compile bcrypt.

While I know that this is an issue with bcrypt and not mongoose-troop, I would really appreciate it if there was some way I or any Windows user could install this package.

Thanks :-)

use of FooSchema in place of fooModel in sample code;

var fooModel = mongoose.model('foo', FooSchema)
  , instance = new FooSchema({ text: 'i am the batman' })

should be

  , instance = new fooModel({ text: 'i am the batman' })

The above is from #keywords, same usage is done across other plugins

obfuscate should be a regular function

The way obfuscate is used with setters/getters is rather unusual. It should probably just be a obfuscate static+instance method and a deobfuscate static method.

i.e. instead of:

// obfuscate
var foo = new FooModel(data)
var obfuscated = foo.obfuscate

// deobfuscate
var emptyFoo = new FooModel()
emptyFoo.deobfuscate = obfuscated

More like:

// obfuscate
var foo = new FooModel(data)
var obfuscated = foo.obfuscate() // OR
obfuscated = FooModel.obfuscate(foo.obfuscate) 

// deobfuscate
FooModel.deobfuscate(obfuscated)

IMO, using getters/setters like this doesn't adequately communicate the intent of the code, the telltale sign being that obfuscate and deobfuscate are verbs, thus should probably be functions, rather than properties.

Also, this gets rid of the need for a dummy object during deobfuscation i.e. emptyFoo.

No example for REST Controller generation

Hey there, thanks for making this!

In the REST section it says

Create a REST-ful controller for your models for use with flatiron/director, express, dnode or socket.io

but there's no example. I also looked in the examples folder, but didn't see anything there either.

Mongoose 3 doesn't accept arrays for query selects.

When using Mongoose 3 alpha, the pagination plugin causes the following error:

TypeError: Invalid select() argument. Must be a string or object.

Turns out that support for arrays of fields has been removed from the Mongoose query select. The default for the fields select in mongoose-troop is [] and therefore triggers the error.

merge doesn't work on deep paths

First, thanks for the really useful library.

The merge utility doesn't appear to work on deeply nested paths. For example, if I have a schema:

name:
    first: String
    last: String

then the first and last properties aren't merged into the parent object. It looks like this is because the value is retrieved on the source document by array getter (e.g. doc[name]), and when name is "name.first" the retrieval fails.

(I think this is relatively straightforward to fix, but I also believe you need to code for edge cases around circular references, which if is the case complicates things some. it's possible the code from node.extend could be leveraged?...)

Keywords plugin overrides existing fields

If a source field already exists in the schema, the plugin will override it, meaning any custom validations, etc. on that field will be removed.

var schema = new Schema({
   title : {
    type : String,
    required : true
  }
});

schema.plugin(keywords, { source : 'title' });

// This will fail:
assert(schema.paths.title.options.required === true);

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.