tblobaum / mongoose-troop Goto Github PK
View Code? Open in Web Editor NEWplugins for your mongoose schemas.
License: MIT License
plugins for your mongoose schemas.
License: MIT License
I was getting the error described here: https://github.com/Anephenix/dashku/issues/3
Changing bcrypt version to 0.6.0 fixed the issue
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!
Links under Contents header should be changed from:
https://github.com/tblobaum/mongoose-troop#Troop.timestamp
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?
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.
Just a little prod to try encourage you to fill out the docs and tests more.
Hello I try to use the timestamp
plugin but only modified
field is created the created
time field is not... any idea?
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.
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 :-)
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
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
.
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.
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.
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?...)
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);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.