no testnodebuggable was executed 怎么办

请帮我解决下NPM安装异常问题 - CNode技术社区
这家伙很懒,什么个性签名都没有留下。
npm安装各种模块,虽然能安装,但最后总跳出错误信息,百思不得其解。兄弟刚从.net平台投奔node,望诸位高手提携一下,指点迷津
0 info it worked if it ends with ok
1 verbose cli [ ‘C:\Program Files\nodejs\\node.exe’,
1 verbose cli
‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’,
1 verbose cli
‘install’,
1 verbose cli
‘mongoose’ ]
2 info using npm.2.3
3 info using node.8.18
4 verbose node symlink C:\Program Files\nodejs\node.exe
5 verbose read json F:\MyWorks\WishDNS\package.json
6 warn package.json application-name.0.1 No
file found!
7 verbose read json F:\MyWorks\WishDNS\node_modules\express\package.json
8 verbose read json F:\MyWorks\WishDNS\node_modules\frisby\package.json
9 verbose read json F:\MyWorks\WishDNS\node_modules\mongoose\package.json
10 verbose from cache F:\MyWorks\WishDNS\package.json
11 verbose readDependencies using package.json deps
12 verbose cache add [ ‘mongoose’, null ]
13 verbose cache add name=undefined spec=“mongoose” args=[“mongoose”,null]
14 verbose parsed url { pathname: ‘mongoose’, path: ‘mongoose’, href: ‘mongoose’ }
15 silly lockFile f25dbdd3-mongoose mongoose
16 verbose lock mongoose C:\Users\jiang\AppData\Roaming\npm-cache\f25dbdd3-mongoose.lock
17 silly lockFile f25dbdd3-mongoose mongoose
18 verbose addNamed [ ‘mongoose’, ‘’ ]
19 verbose addNamed [ null, ‘’ ]
20 silly lockFile 3bb0fc31-mongoose mongoose@
21 verbose lock mongoose@ C:\Users\jiang\AppData\Roaming\npm-cache\3bb0fc31-mongoose.lock
22 silly addNameRange { name: ‘mongoose’, range: ‘’, hasData: false }
23 verbose url raw mongoose
24 verbose url resolving [ ‘’, ‘./mongoose’ ]
25 verbose url resolved
26 info trying registry request attempt 1 at 09:01:28
27 verbose etag “7JQWKI9LQP3IJW4Y8C4DNQB9B&
28 http GET
29 http 304
30 silly registry.get cb [ 304,
30 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
30 silly registry.get
etag: ‘“7JQWKI9LQP3IJW4Y8C4DNQB9B”’,
30 silly registry.get
date: ‘Sat, 26 Jan :54 GMT’,
30 silly registry.get
‘content-length’: ‘0’ } ]
31 verbose etag mongoose from cache
32 silly addNameRange number 2 { name: ‘mongoose’, range: ‘’, hasData: true }
33 silly addNameRange versions [ ‘mongoose’,
33 silly addNameRange
[ ‘0.0.1’,
33 silly addNameRange
‘0.0.2’,
33 silly addNameRange
‘0.0.3’,
33 silly addNameRange
‘0.0.4’,
33 silly addNameRange
‘0.0.5’,
33 silly addNameRange
‘1.0.0’,
33 silly addNameRange
‘1.0.1’,
33 silly addNameRange
‘1.0.2’,
33 silly addNameRange
‘0.0.6’,
33 silly addNameRange
‘1.0.3’,
33 silly addNameRange
‘1.0.4’,
33 silly addNameRange
‘1.0.5’,
33 silly addNameRange
‘1.0.6’,
33 silly addNameRange
‘1.0.7’,
33 silly addNameRange
‘1.0.8’,
33 silly addNameRange
‘1.0.10’,
33 silly addNameRange
‘1.0.11’,
33 silly addNameRange
‘1.0.12’,
33 silly addNameRange
‘1.0.13’,
33 silly addNameRange
‘1.0.14’,
33 silly addNameRange
‘1.0.15’,
33 silly addNameRange
‘1.0.16’,
33 silly addNameRange
‘1.1.0’,
33 silly addNameRange
‘1.1.1’,
33 silly addNameRange
‘1.1.2’,
33 silly addNameRange
‘1.1.3’,
33 silly addNameRange
‘1.1.4’,
33 silly addNameRange
‘1.1.5’,
33 silly addNameRange
‘1.1.6’,
33 silly addNameRange
‘1.1.7’,
33 silly addNameRange
‘1.1.8’,
33 silly addNameRange
‘1.1.9’,
33 silly addNameRange
‘1.1.10’,
33 silly addNameRange
‘1.1.11’,
33 silly addNameRange
‘1.1.12’,
33 silly addNameRange
‘1.1.13’,
33 silly addNameRange
‘1.1.14’,
33 silly addNameRange
‘1.1.15’,
33 silly addNameRange
‘1.1.16’,
33 silly addNameRange
‘1.1.17’,
33 silly addNameRange
‘1.1.18’,
33 silly addNameRange
‘1.1.19’,
33 silly addNameRange
‘1.1.20’,
33 silly addNameRange
‘1.1.21’,
33 silly addNameRange
‘1.1.22’,
33 silly addNameRange
‘1.1.23’,
33 silly addNameRange
‘1.1.24’,
33 silly addNameRange
‘1.1.25’,
33 silly addNameRange
‘1.2.0’,
33 silly addNameRange
‘1.3.0’,
33 silly addNameRange
‘1.3.1’,
33 silly addNameRange
‘1.3.2’,
33 silly addNameRange
‘1.3.3’,
33 silly addNameRange
‘1.3.4’,
33 silly addNameRange
‘1.3.5’,
33 silly addNameRange
‘1.3.6’,
33 silly addNameRange
‘1.3.7’,
33 silly addNameRange
‘1.4.0’,
33 silly addNameRange
‘1.5.0’,
33 silly addNameRange
‘1.6.0’,
33 silly addNameRange
‘1.7.2’,
33 silly addNameRange
‘1.7.3’,
33 silly addNameRange
‘1.7.4’,
33 silly addNameRange
‘1.8.0’,
33 silly addNameRange
‘1.8.1’,
33 silly addNameRange
‘1.8.2’,
33 silly addNameRange
‘1.8.3’,
33 silly addNameRange
‘1.8.4’,
33 silly addNameRange
‘2.0.0’,
33 silly addNameRange
‘2.0.1’,
33 silly addNameRange
‘2.0.2’,
33 silly addNameRange
‘2.0.3’,
33 silly addNameRange
‘2.0.4’,
33 silly addNameRange
‘2.1.0’,
33 silly addNameRange
‘2.1.1’,
33 silly addNameRange
‘2.1.2’,
33 silly addNameRange
‘2.1.3’,
33 silly addNameRange
‘2.1.4’,
33 silly addNameRange
‘2.2.0’,
33 silly addNameRange
‘2.2.1’,
33 silly addNameRange
‘2.2.2’,
33 silly addNameRange
‘2.2.3’,
33 silly addNameRange
‘2.2.4’,
33 silly addNameRange
‘2.3.0’,
33 silly addNameRange
‘2.3.1’,
33 silly addNameRange
‘2.3.2’,
33 silly addNameRange
‘2.3.3’,
33 silly addNameRange
‘2.3.4’,
33 silly addNameRange
‘2.3.5’,
33 silly addNameRange
‘2.3.6’,
33 silly addNameRange
‘2.3.7’,
33 silly addNameRange
‘2.3.8’,
33 silly addNameRange
‘2.3.9’,
33 silly addNameRange
‘2.3.10’,
33 silly addNameRange
‘2.3.11’,
33 silly addNameRange
‘2.3.12’,
33 silly addNameRange
‘2.3.13’,
33 silly addNameRange
‘2.4.0’,
33 silly addNameRange
‘2.4.1’,
33 silly addNameRange
‘2.4.2’,
33 silly addNameRange
‘2.4.3’,
33 silly addNameRange
‘2.4.4’,
33 silly addNameRange
‘2.4.5’,
33 silly addNameRange
‘2.4.6’,
33 silly addNameRange
‘2.4.7’,
33 silly addNameRange
‘2.4.8’,
33 silly addNameRange
‘2.4.9’,
33 silly addNameRange
‘2.4.10’,
33 silly addNameRange
‘2.5.0’,
33 silly addNameRange
‘2.5.1’,
33 silly addNameRange
‘2.5.2’,
33 silly addNameRange
‘2.5.3’,
33 silly addNameRange
‘2.5.4’,
33 silly addNameRange
‘2.5.5’,
33 silly addNameRange
‘2.5.6’,
33 silly addNameRange
‘2.5.7’,
33 silly addNameRange
‘2.5.8’,
33 silly addNameRange
‘2.5.9’,
33 silly addNameRange
‘2.5.10’,
33 silly addNameRange
‘2.5.11’,
33 silly addNameRange
‘2.5.12’,
33 silly addNameRange
‘2.5.13’,
33 silly addNameRange
‘2.5.14’,
33 silly addNameRange
‘2.6.0’,
33 silly addNameRange
‘2.6.1’,
33 silly addNameRange
‘2.6.2’,
33 silly addNameRange
‘2.6.3’,
33 silly addNameRange
‘2.6.4’,
33 silly addNameRange
‘2.6.5’,
33 silly addNameRange
‘2.6.6’,
33 silly addNameRange
‘2.6.7’,
33 silly addNameRange
‘2.6.8’,
33 silly addNameRange
‘2.7.0’,
33 silly addNameRange
‘3.0.0alpha1’,
33 silly addNameRange
‘2.7.1’,
33 silly addNameRange
‘2.7.2’,
33 silly addNameRange
‘3.0.0alpha2’,
33 silly addNameRange
‘3.0.0rc0’,
33 silly addNameRange
‘2.7.4’,
33 silly addNameRange
‘2.7.3’,
33 silly addNameRange
‘3.0.0’,
33 silly addNameRange
‘3.0.1’,
33 silly addNameRange
‘3.0.2’,
33 silly addNameRange
‘2.8.0’,
33 silly addNameRange
‘3.0.3’,
33 silly addNameRange
‘3.1.0’,
33 silly addNameRange
‘2.8.1’,
33 silly addNameRange
‘3.1.2-pre’,
33 silly addNameRange
‘3.1.1’,
33 silly addNameRange
‘2.8.2’,
33 silly addNameRange
‘2.8.3’,
33 silly addNameRange
‘3.1.2’,
33 silly addNameRange
‘2.9.0’,
33 silly addNameRange
‘3.2.0’,
33 silly addNameRange
‘2.9.1’,
33 silly addNameRange
‘3.2.1’,
33 silly addNameRange
‘2.9.2’,
33 silly addNameRange
‘3.2.2’,
33 silly addNameRange
‘3.3.0’,
33 silly addNameRange
‘3.3.1’,
33 silly addNameRange
‘2.9.3’,
33 silly addNameRange
‘3.4.0’,
33 silly addNameRange
‘2.9.4’,
33 silly addNameRange
‘2.9.5’,
33 silly addNameRange
‘3.5.0’,
33 silly addNameRange
‘3.5.1’,
33 silly addNameRange
‘3.5.2’,
33 silly addNameRange
‘3.5.3’,
33 silly addNameRange
‘2.9.6’,
33 silly addNameRange
‘2.9.7’,
33 silly addNameRange
‘3.5.4’ ] ]
34 verbose addNamed [ ‘mongoose’, ‘3.5.4’ ]
35 verbose addNamed [ ‘3.5.4’, ‘3.5.4’ ]
36 silly lockFile 22f6d366-mongoose-3-5-4 mongoose.5.4
37 verbose lock mongoose.5.4 C:\Users\jiang\AppData\Roaming\npm-cache\22f6d366-mongoose-3-5-4.lock
38 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\mongoose\3.5.4\package\package.json
39 silly lockFile 22f6d366-mongoose-3-5-4 mongoose.5.4
40 silly lockFile 3bb0fc31-mongoose mongoose@
41 silly resolved [ { name: ‘mongoose’,
41 silly resolved
description: ‘Mongoose MongoDB ODM’,
41 silly resolved
version: ‘3.5.4’,
41 silly resolved
author: { name: ‘Guillermo Rauch’, email: ‘’ },
41 silly resolved
41 silly resolved
[ ‘mongodb’,
41 silly resolved
‘mongoose’,
41 silly resolved
41 silly resolved
41 silly resolved
‘datastore’,
41 silly resolved
‘nosql’,
41 silly resolved
41 silly resolved
41 silly resolved
41 silly resolved
‘database’ ],
41 silly resolved
dependencies:
41 silly resolved
{ hooks: ‘0.2.1’,
41 silly resolved
mongodb: ‘1.2.8’,
41 silly resolved
ms: ‘0.1.0’,
41 silly resolved
sliced: ‘0.0.3’,
41 silly resolved
muri: ‘0.1.0’ },
41 silly resolved
devDependencies:
41 silly resolved
{ mocha: ‘1.7.4’,
41 silly resolved
‘node-static’: ‘0.5.9’,
41 silly resolved
dox: ‘0.3.1’,
41 silly resolved
jade: ‘0.26.3’,
41 silly resolved
‘highlight.js’: ‘7.0.1’,
41 silly resolved
markdown: ‘0.3.1’ },
41 silly resolved
directories: { lib: ‘./lib/mongoose’ },
41 silly resolved
scripts: { test: ‘make test’ },
41 silly resolved
main: ‘./index.js’,
41 silly resolved
engines: { node: ‘&= 0.4.0’ },
41 silly resolved
41 silly resolved
{ url: ‘’,
41 silly resolved
email: ‘’ },
41 silly resolved
repository: { type: ‘git’, url: ‘git:///LearnBoost/mongoose.git’ },
41 silly resolved
homepage: ‘’,
41 silly resolved
readme: '## What’s Mongoose?\n\nMongoose is a
object modeling tool designed to work in an asynchronous environment.\n\nDefining a model is as easy as:\n\n
var Comment = new Schema({\n
: String\n
: String\n
var BlogPost = new Schema({\n
: ObjectId\n
: String\n
: String\n
: Buffer\n
, comments
: [Comment]\n
votes : Number\n
: Number\n
var Post = mongoose.model(‘BlogPost’, BlogPost);\n\n## Documentation\n\n\n\n## Try it live\n&a href=“” target=”_blank&&&img src=“” style=“width:67height:25”&&/a&\n## Installation\n\nThe recommended way is through the excellent :\n\n
$ npm install mongoose\n\nOtherwise, you can check it in your repository and then expose it:\n\n
$ git clone git:///LearnBoost/mongoose.git node_modules/mongoose/\n\nAnd install dependency modules written on package.json.\n\nThen you can require it:\n\n
require(‘mongoose’)\n\n## Connecting to MongoDB\n\nFirst, we need to define a connection. If your app uses only one database, you should use mongose.connect. If you need to create additional connections, use mongoose.createConnection.\n\nBoth connect and createConnection take a mongodb:// URI, or the parameters host, database, port, options.\n\n
var mongoose = require(‘mongoose’);\n\n
mongoose.connect(‘mongodb://localhost/my_database’);\n\nOnce connected, the open event is fired on the Connection instance. If you’re using mongoose.connect, the Connection is mongoose.connection. Otherwise, mongoose.createConnection return value is a Connection.\n\nImportant! Mongoose buffers all the commands until it’s connected to the database. This means that you don’t have to wait until it connects to MongoDB in order to define models, run queries, etc.\n\n## Defining a Model\n\nModels are defined through the Schema interface. \n\n
var Schema = mongoose.Schema\n
, ObjectId = Schema.ObjectId;\n\n
var BlogPost = new Schema({\n
: ObjectId\n
: String\n
: String\n
});\n\nAside from defining the structure of your documents and the types of data you’re storing, a Schema handles the definition of:\n\n*
(async and sync)\n* \n* \n* \n* \n* \n*
definition\n*
definition\n* \n* \n\nThe following example shows some of these features:\n\n
var Comment = new Schema({\n
{ type: String, default: ‘hahaha’ }\n
{ type: Number, min: 18, index: true }\n
{ type: String, match: /[a-z]/ }\n
{ type: Date, default: Date.now }\n
// a setter\n
Comment.path(‘name’).set(function (v) {\n
return capitalize(v);\n
// middleware\n
Comment.pre(‘save’, function (next) {\n
notify(this.get(‘email’));\n
});\n\nTake a look at the example in examples/schema.js for an end-to-end example of a typical setup.\n\n## Accessing a Model\n\nOnce we define a model through mongoose.model(\'ModelName\', mySchema), we can access it through the same function\n\n
var myModel = mongoose.model(‘ModelName’);\n\nOr just do it all at once\n\n
var MyModel = mongoose.model(‘ModelName’, mySchema);\n\nWe can then instantiate it, and save it:\n\n
var instance = new MyModel();\n
instance.my.key = ‘hello’;\n
instance.save(function (err) {\n
});\n\nOr we can find documents from the same collection\n\n
MyModel.find({}, function (err, docs) {\n
// docs.forEach\n
});\n\nYou can also findOne, findById, update, etc. For more details check out .\n\nImportant! If you opened a separate connection using mongoose.createConnection() but attempt to access the model through mongoose.model(\'ModelName\') it will not work as expected since it is not hooked up to an active db connection. In this case access your model through the connection you created:\n\n
var conn = mongoose.createConnection(‘your connection string’);\n
var MyModel = conn.model(‘ModelName’, schema);\n
var m = new MyM\n
m.save() // works\n\n
var conn = mongoose.createConnection(‘your connection string’);\n
var MyModel = mongoose.model(‘ModelName’, schema);\n
var m = new MyM\n
m.save() // does not work b/c the default connection object was never connected\n\n## Embedded Documents\n\nIn the first example snippet, we defined a key in the Schema that looks like:\n\n
comments: [Comments]\n\nWhere Comments is a Schema we created. This means that creating embedded documents is as simple as:\n\n
// retrieve my model\n
var BlogPost = mongoose.model(‘BlogPost’);\n\n
// create a blog post\n
var post = new BlogPost();\n\n
// create a comment\n
ments.push({ title: ‘My comment’ });\n\n
post.save(function (err) {\n
if (!err) console.log(‘Success!’);\n
});\n\nThe same goes for removing them:\n\n
BlogPost.findById(myId, function (err, post) {\n
if (!err) {\n
ments[0].remove();\n
post.save(function (err) {\n
// do something\n
});\n\nEmbedded documents enjoy all the same features as your models. Defaults, validators, middleware. Whenever an error occurs, it’s bubbled to the save() error callback, so error handling is a snap!\n\nMongoose interacts with your embedded documents in arrays atomically, out of the box.\n\n## Middleware\n\nMiddleware is one of the most exciting features about Mongoose. Middleware takes away all the pain of nested callbacks.\n\nMiddleware are defined at the Schema level and are applied for the methods init (when a document is initialized with data from MongoDB), save (when a document or embedded document is saved).\n\nThere’s two types of middleware:\n\n- Serial\n
Serial middleware are defined like:\n\n
.pre(method, function (next, methodArg1, methodArg2, …) {\n
They’re executed one after the other, when each middleware calls next.\n\n
You can also intercept the method‘s incoming arguments via your middleware – notice methodArg1, methodArg2, etc in the pre definition above. See section “Intercepting and mutating method arguments” below.\n\n\n- Parallel\n
Parallel middleware offer more fine-grained flow control, and are defined like:\n\n
.pre(method, true, function (next, done, methodArg1, methodArg2) {\n
Parallel middleware can next() immediately, but the final argument will be called when all the parallel middleware have called done().\n\n### Error handling\n\nIf any middleware calls next or done with an Error instance, the flow is interrupted, and the error is passed to the function passed as an argument.\n\nFor example:\n\n
schema.pre(‘save’, function (next) {\n
// something goes wrong\n
next(new Error(‘something went wrong’));\n
// later…\n\n
myModel.save(function (err) {\n
// err can come from a middleware\n
});\n\n### Intercepting and mutating method arguments\n\nYou can intercept method arguments via middleware.\n\nFor example, this would allow you to broadcast changes about your Documents every time someone sets a path in your Document to a new value:\n\n
schema.pre(‘set’, function (next, path, val, typel) {\n
// this is the current Document\n
this.emit(‘set’, path, val);\n\n
// Pass control to the next pre\n
});\n\nMoreover, you can mutate the incoming method arguments so that subsequent middleware see different values for those arguments. To do so, just pass the new values to next:\n\n
.pre(method, function firstPre (next, methodArg1, methodArg2) {\n
// Mutate methodArg1\n
next(“altered-” + methodArg1.toString(), methodArg2);\n
// pre declaration is chainable\n
.pre(method, function secondPre (next, methodArg1, methodArg2) {\n
console.log(methodArg1);\n
// =& ‘altered-originalValOfMethodArg1’ \n
console.log(methodArg2);\n
// =& ‘originalValOfMethodArg2’ \n
// Passing no arguments to next automatically passes along the current argument values\n
// i.e., the following next() is equivalent to next(methodArg1, methodArg2)\n
// and also equivalent to, with the example method arg \n
// values, next(\'altered-originalValOfMethodArg1\', \'originalValOfMethodArg2\')\n
})\n\n### Schema gotcha\n\ntype, when used in a schema has special meaning within Mongoose. If your schema requires using type as a nested property you must use object notation:\n\n
new Schema({\n
broken: { type: Boolean }\n
, asset : {\n
name: String\n
, type: String // uh oh, it broke. asset will be interpreted as String\n
new Schema({\n
works: { type: Boolean }\n
, asset : {\n
name: String\n
, type: { type: String } // works. asset is an object with a type property\n
});\n\n## API docs\n\nYou can find the
generated API docs .\n\n## Getting support\n\n- Google Groups \n- (irc) #mongoosejs on freenode\n- reporting \n- \n\n## Driver access\n\nThe driver being used defaults to
and is directly accessible through YourModel.collection. Note: using the driver directly bypasses all Mongoose power-tools like validation, getters, setters, hooks, etc.\n\n## Mongoose Plugins\n\nTake a peek at the
to see related modules from the community.\n\n## Contributing to Mongoose\n\n### Cloning the repository\n\n
git clone git:///LearnBoost/mongoose.git\n\n### Guidelines\n\nSee .\n\n## Credits\n\n\n\n## License\n\nCopyright (C)
LearnBoost &&\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n’Software’), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n’,
41 silly resolved
readmeFilename: ‘’,
41 silly resolved
_id: ‘mongoose.5.4’,
41 silly resolved
_from: ‘mongoose@’ } ]
42 info install mongoose.5.4 into F:\MyWorks\WishDNS
43 info installOne mongoose.5.4
44 verbose from cache C:\Users\jiang\AppData\Roaming\npm-cache\mongoose\3.5.4\package\package.json
45 info F:\MyWorks\WishDNS\node_modules\mongoose unbuild
46 verbose from cache F:\MyWorks\WishDNS\node_modules\mongoose\package.json
47 info preuninstall mongoose.5.4
48 info uninstall mongoose.5.4
49 verbose true,F:\MyWorks\WishDNS\node_modules,F:\MyWorks\WishDNS\node_modules unbuild mongoose.5.4
50 info postuninstall mongoose.5.4
51 verbose tar unpack C:\Users\jiang\AppData\Roaming\npm-cache\mongoose\3.5.4\package.tgz
52 silly lockFile e4eee3e7-ks-WishDNS-node-modules-mongoose F:\MyWorks\WishDNS\node_modules\mongoose
53 verbose lock F:\MyWorks\WishDNS\node_modules\mongoose C:\Users\jiang\AppData\Roaming\npm-cache\e4eee3e7-ks-WishDNS-node-modules-mongoose.lock
54 silly gunzTarPerm modes [ ‘755’, ‘644’ ]
55 silly gunzTarPerm extractEntry package.json
56 silly gunzTarPerm modified mode [ ‘package.json’, 438, 420 ]
57 silly gunzTarPerm extractEntry .npmignore
58 silly gunzTarPerm modified mode [ ‘.npmignore’, 438, 420 ]
59 silly gunzTarPerm extractEntry
60 silly gunzTarPerm modified mode [ ‘’, 438, 420 ]
61 silly gunzTarPerm extractEntry static.js
62 silly gunzTarPerm modified mode [ ‘static.js’, 438, 420 ]
63 silly gunzTarPerm extractEntry website.js
64 silly gunzTarPerm modified mode [ ‘website.js’, 438, 420 ]
65 silly gunzTarPerm extractEntry index.js
66 silly gunzTarPerm modified mode [ ‘index.js’, 438, 420 ]
67 silly gunzTarPerm extractEntry .travis.yml
68 silly gunzTarPerm modified mode [ ‘.travis.yml’, 438, 420 ]
69 silly gunzTarPerm extractEntry lib/collection.js
70 silly gunzTarPerm modified mode [ ‘lib/collection.js’, 438, 420 ]
71 silly gunzTarPerm extractEntry lib/error.js
72 silly gunzTarPerm modified mode [ ‘lib/error.js’, 438, 420 ]
73 silly gunzTarPerm extractEntry lib/statemachine.js
74 silly gunzTarPerm modified mode [ ‘lib/statemachine.js’, 438, 420 ]
75 silly gunzTarPerm extractEntry lib/index.js
76 silly gunzTarPerm modified mode [ ‘lib/index.js’, 438, 420 ]
77 silly gunzTarPerm extractEntry lib/utils.js
78 silly gunzTarPerm modified mode [ ‘lib/utils.js’, 438, 420 ]
79 silly gunzTarPerm extractEntry lib/namedscope.js
80 silly gunzTarPerm modified mode [ ‘lib/namedscope.js’, 438, 420 ]
81 silly gunzTarPerm extractEntry lib/connection.js
82 silly gunzTarPerm modified mode [ ‘lib/connection.js’, 438, 420 ]
83 silly gunzTarPerm extractEntry lib/query.js
84 silly gunzTarPerm modified mode [ ‘lib/query.js’, 438, 420 ]
85 silly gunzTarPerm extractEntry lib/querystream.js
86 silly gunzTarPerm modified mode [ ‘lib/querystream.js’, 438, 420 ]
87 silly gunzTarPerm extractEntry lib/schematype.js
88 silly gunzTarPerm modified mode [ ‘lib/schematype.js’, 438, 420 ]
89 silly gunzTarPerm extractEntry lib/document.js
90 silly gunzTarPerm modified mode [ ‘lib/document.js’, 438, 420 ]
91 silly gunzTarPerm extractEntry lib/schema.js
92 silly gunzTarPerm modified mode [ ‘lib/schema.js’, 438, 420 ]
93 silly gunzTarPerm extractEntry lib/connectionstate.js
94 silly gunzTarPerm modified mode [ ‘lib/connectionstate.js’, 438, 420 ]
95 silly gunzTarPerm extractEntry lib/schemadefault.js
96 silly gunzTarPerm modified mode [ ‘lib/schemadefault.js’, 438, 420 ]
97 silly gunzTarPerm extractEntry lib/model.js
98 silly gunzTarPerm modified mode [ ‘lib/model.js’, 438, 420 ]
99 silly gunzTarPerm extractEntry lib/virtualtype.js
100 silly gunzTarPerm modified mode [ ‘lib/virtualtype.js’, 438, 420 ]
101 silly gunzTarPerm extractEntry lib/promise.js
102 silly gunzTarPerm modified mode [ ‘lib/promise.js’, 438, 420 ]
103 silly gunzTarPerm extractEntry lib/schema/array.js
104 silly gunzTarPerm modified mode [ ‘lib/schema/array.js’, 438, 420 ]
105 silly gunzTarPerm extractEntry lib/schema/boolean.js
106 silly gunzTarPerm modified mode [ ‘lib/schema/boolean.js’, 438, 420 ]
107 silly gunzTarPerm extractEntry lib/schema/buffer.js
108 silly gunzTarPerm modified mode [ ‘lib/schema/buffer.js’, 438, 420 ]
109 silly gunzTarPerm extractEntry lib/schema/date.js
110 silly gunzTarPerm modified mode [ ‘lib/schema/date.js’, 438, 420 ]
111 silly gunzTarPerm extractEntry lib/schema/documentarray.js
112 silly gunzTarPerm modified mode [ ‘lib/schema/documentarray.js’, 438, 420 ]
113 silly gunzTarPerm extractEntry lib/schema/index.js
114 silly gunzTarPerm modified mode [ ‘lib/schema/index.js’, 438, 420 ]
115 silly gunzTarPerm extractEntry lib/schema/mixed.js
116 silly gunzTarPerm modified mode [ ‘lib/schema/mixed.js’, 438, 420 ]
117 silly gunzTarPerm extractEntry lib/schema/number.js
118 silly gunzTarPerm modified mode [ ‘lib/schema/number.js’, 438, 420 ]
119 silly gunzTarPerm extractEntry lib/schema/objectid.js
120 silly gunzTarPerm modified mode [ ‘lib/schema/objectid.js’, 438, 420 ]
121 silly gunzTarPerm extractEntry lib/schema/string.js
122 silly gunzTarPerm modified mode [ ‘lib/schema/string.js’, 438, 420 ]
123 silly gunzTarPerm extractEntry lib/errors/cast.js
124 silly gunzTarPerm modified mode [ ‘lib/errors/cast.js’, 438, 420 ]
125 silly gunzTarPerm extractEntry lib/errors/document.js
126 silly gunzTarPerm modified mode [ ‘lib/errors/document.js’, 438, 420 ]
127 silly gunzTarPerm extractEntry lib/errors/missingSchema.js
128 silly gunzTarPerm modified mode [ ‘lib/errors/missingSchema.js’, 438, 420 ]
129 silly gunzTarPerm extractEntry lib/errors/overwriteModel.js
130 silly gunzTarPerm modified mode [ ‘lib/errors/overwriteModel.js’, 438, 420 ]
131 silly gunzTarPerm extractEntry lib/errors/validation.js
132 silly gunzTarPerm modified mode [ ‘lib/errors/validation.js’, 438, 420 ]
133 silly gunzTarPerm extractEntry lib/errors/validator.js
134 silly gunzTarPerm modified mode [ ‘lib/errors/validator.js’, 438, 420 ]
135 silly gunzTarPerm extractEntry lib/errors/version.js
136 silly gunzTarPerm modified mode [ ‘lib/errors/version.js’, 438, 420 ]
137 silly gunzTarPerm extractEntry lib/types/array.js
138 silly gunzTarPerm modified mode [ ‘lib/types/array.js’, 438, 420 ]
139 silly gunzTarPerm extractEntry lib/types/buffer.js
140 silly gunzTarPerm modified mode [ ‘lib/types/buffer.js’, 438, 420 ]
141 silly gunzTarPerm extractEntry lib/types/documentarray.js
142 silly gunzTarPerm modified mode [ ‘lib/types/documentarray.js’, 438, 420 ]
143 silly gunzTarPerm extractEntry lib/types/embedded.js
144 silly gunzTarPerm modified mode [ ‘lib/types/embedded.js’, 438, 420 ]
145 silly gunzTarPerm extractEntry lib/types/index.js
146 silly gunzTarPerm modified mode [ ‘lib/types/index.js’, 438, 420 ]
147 silly gunzTarPerm extractEntry lib/types/objectid.js
148 silly gunzTarPerm modified mode [ ‘lib/types/objectid.js’, 438, 420 ]
149 silly gunzTarPerm extractEntry lib/drivers/node-mongodb-native/binary.js
150 silly gunzTarPerm modified mode [ ‘lib/drivers/node-mongodb-native/binary.js’, 438, 420 ]
151 silly gunzTarPerm extractEntry lib/drivers/node-mongodb-native/collection.js
152 silly gunzTarPerm modified mode [ ‘lib/drivers/node-mongodb-native/collection.js’, 438, 420 ]
153 silly gunzTarPerm extractEntry lib/drivers/node-mongodb-native/connection.js
154 silly gunzTarPerm modified mode [ ‘lib/drivers/node-mongodb-native/connection.js’, 438, 420 ]
155 silly gunzTarPerm extractEntry lib/drivers/node-mongodb-native/objectid.js
156 silly gunzTarPerm modified mode [ ‘lib/drivers/node-mongodb-native/objectid.js’, 438, 420 ]
157 silly gunzTarPerm extractEntry
158 silly gunzTarPerm modified mode [ ‘’, 438, 420 ]
159 silly gunzTarPerm extractEntry examples/schema.js
160 silly gunzTarPerm modified mode [ ‘examples/schema.js’, 438, 420 ]
161 silly gunzTarPerm extractEntry
162 silly gunzTarPerm modified mode [ ‘’, 438, 420 ]
163 verbose read json F:\MyWorks\WishDNS\node_modules\mongoose\package.json
164 silly lockFile e4eee3e7-ks-WishDNS-node-modules-mongoose F:\MyWorks\WishDNS\node_modules\mongoose
165 info preinstall mongoose.5.4
166 verbose from cache F:\MyWorks\WishDNS\node_modules\mongoose\package.json
167 verbose readDependencies using package.json deps
168 verbose from cache F:\MyWorks\WishDNS\node_modules\mongoose\package.json
169 verbose readDependencies using package.json deps
170 verbose cache add [ ‘hooks.2.1’, null ]
171 verbose cache add name=undefined spec=“hooks.2.1” args=[“hooks.2.1”,null]
172 verbose parsed url { pathname: ‘hooks.2.1’,
172 verbose parsed url
path: ‘hooks.2.1’,
172 verbose parsed url
href: ‘hooks.2.1’ }
173 verbose cache add name=“hooks” spec=“0.2.1” args=[“hooks”,“0.2.1”]
174 verbose parsed url { pathname: ‘0.2.1’, path: ‘0.2.1’, href: ‘0.2.1’ }
175 verbose addNamed [ ‘hooks’, ‘0.2.1’ ]
176 verbose addNamed [ ‘0.2.1’, ‘0.2.1’ ]
177 silly lockFile 207ce50b-hooks-0-2-1 hooks.2.1
178 verbose lock hooks.2.1 C:\Users\jiang\AppData\Roaming\npm-cache\207ce50b-hooks-0-2-1.lock
179 verbose cache add [ ‘mongodb.2.8’, null ]
180 verbose cache add name=undefined spec=“mongodb.2.8” args=[“mongodb.2.8”,null]
181 verbose parsed url { pathname: ‘mongodb.2.8’,
181 verbose parsed url
path: ‘mongodb.2.8’,
181 verbose parsed url
href: ‘mongodb.2.8’ }
182 verbose cache add name=“mongodb” spec=“1.2.8” args=[“mongodb”,“1.2.8”]
183 verbose parsed url { pathname: ‘1.2.8’, path: ‘1.2.8’, href: ‘1.2.8’ }
184 verbose addNamed [ ‘mongodb’, ‘1.2.8’ ]
185 verbose addNamed [ ‘1.2.8’, ‘1.2.8’ ]
186 silly lockFile -mongodb-1-2-8 mongodb.2.8
187 verbose lock mongodb.2.8 C:\Users\jiang\AppData\Roaming\npm-cache\-mongodb-1-2-8.lock
188 verbose cache add [ ‘ms.1.0’, null ]
189 verbose cache add name=undefined spec=“ms.1.0” args=[“ms.1.0”,null]
190 verbose parsed url { pathname: ‘ms.1.0’, path: ‘ms.1.0’, href: ‘ms.1.0’ }
191 verbose cache add name=“ms” spec=“0.1.0” args=[“ms”,“0.1.0”]
192 verbose parsed url { pathname: ‘0.1.0’, path: ‘0.1.0’, href: ‘0.1.0’ }
193 verbose addNamed [ ‘ms’, ‘0.1.0’ ]
194 verbose addNamed [ ‘0.1.0’, ‘0.1.0’ ]
195 silly lockFile 9555626c-ms-0-1-0 ms.1.0
196 verbose lock ms.1.0 C:\Users\jiang\AppData\Roaming\npm-cache\9555626c-ms-0-1-0.lock
197 verbose cache add [ ‘sliced.0.3’, null ]
198 verbose cache add name=undefined spec=“sliced.0.3” args=[“sliced.0.3”,null]
199 verbose parsed url { pathname: ‘sliced.0.3’,
199 verbose parsed url
path: ‘sliced.0.3’,
199 verbose parsed url
href: ‘sliced.0.3’ }
200 verbose cache add name=“sliced” spec=“0.0.3” args=[“sliced”,“0.0.3”]
201 verbose parsed url { pathname: ‘0.0.3’, path: ‘0.0.3’, href: ‘0.0.3’ }
202 verbose addNamed [ ‘sliced’, ‘0.0.3’ ]
203 verbose addNamed [ ‘0.0.3’, ‘0.0.3’ ]
204 silly lockFile 75155ca2-sliced-0-0-3 sliced.0.3
205 verbose lock sliced.0.3 C:\Users\jiang\AppData\Roaming\npm-cache\75155ca2-sliced-0-0-3.lock
206 verbose cache add [ ‘muri.1.0’, null ]
207 verbose cache add name=undefined spec=“muri.1.0” args=[“muri.1.0”,null]
208 verbose parsed url { pathname: ‘muri.1.0’,
208 verbose parsed url
path: ‘muri.1.0’,
208 verbose parsed url
href: ‘muri.1.0’ }
209 verbose cache add name=“muri” spec=“0.1.0” args=[“muri”,“0.1.0”]
210 verbose parsed url { pathname: ‘0.1.0’, path: ‘0.1.0’, href: ‘0.1.0’ }
211 verbose addNamed [ ‘muri’, ‘0.1.0’ ]
212 verbose addNamed [ ‘0.1.0’, ‘0.1.0’ ]
213 silly lockFile e6530fd3-muri-0-1-0 muri.1.0
214 verbose lock muri.1.0 C:\Users\jiang\AppData\Roaming\npm-cache\e6530fd3-muri-0-1-0.lock
215 verbose url raw hooks/0.2.1
216 verbose url resolving [ ‘’, ‘./hooks/0.2.1’ ]
217 verbose url resolved
218 info trying registry request attempt 1 at 09:01:31
219 verbose etag &40UQ0TU5NYNGPQGNYQV0BYXHF&
220 http GET
221 verbose url raw mongodb/1.2.8
222 verbose url resolving [ ‘’, ‘./mongodb/1.2.8’ ]
223 verbose url resolved
224 info trying registry request attempt 1 at 09:01:31
225 verbose etag &7NKLAUOBTUVOLHF7R9JW0KYM9&
226 http GET
227 verbose url raw ms/0.1.0
228 verbose url resolving [ ‘’, ‘./ms/0.1.0’ ]
229 verbose url resolved
230 info trying registry request attempt 1 at 09:01:31
231 verbose etag &D3QUOP814ONZ6GYVY2AIBJL68&
232 http GET
233 verbose url raw sliced/0.0.3
234 verbose url resolving [ ‘’, ‘./sliced/0.0.3’ ]
235 verbose url resolved
236 info trying registry request attempt 1 at 09:01:31
237 verbose etag “D8DVG2H5DOK9ABLBM06DV11AA&
238 http GET
239 verbose url raw muri/0.1.0
240 verbose url resolving [ ‘’, ‘./muri/0.1.0’ ]
241 verbose url resolved
242 info trying registry request attempt 1 at 09:01:31
243 verbose etag “70OB5NVDFF36J6MQLXFPBZ9IT&
244 http GET
245 http 304
246 silly registry.get cb [ 304,
246 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
246 silly registry.get
etag: ‘“7NKLAUOBTUVOLHF7R9JW0KYM9”’,
246 silly registry.get
date: ‘Sat, 26 Jan :57 GMT’,
246 silly registry.get
‘content-length’: ‘0’ } ]
247 verbose etag mongodb/1.2.8 from cache
248 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\mongodb\1.2.8\package\package.json
249 silly lockFile -mongodb-1-2-8 mongodb.2.8
250 http 304
251 silly registry.get cb [ 304,
251 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
251 silly registry.get
etag: ‘“D3QUOP814ONZ6GYVY2AIBJL68”’,
251 silly registry.get
date: ‘Sat, 26 Jan :57 GMT’,
251 silly registry.get
‘content-length’: ‘0’ } ]
252 verbose etag ms/0.1.0 from cache
253 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\ms\0.1.0\package\package.json
254 silly lockFile 9555626c-ms-0-1-0 ms.1.0
255 http 304
256 silly registry.get cb [ 304,
256 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
256 silly registry.get
etag: ‘“70OB5NVDFF36J6MQLXFPBZ9IT”’,
256 silly registry.get
date: ‘Sat, 26 Jan :57 GMT’,
256 silly registry.get
‘content-length’: ‘0’ } ]
257 verbose etag muri/0.1.0 from cache
258 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\muri\0.1.0\package\package.json
259 silly lockFile e6530fd3-muri-0-1-0 muri.1.0
260 http 304
261 silly registry.get cb [ 304,
261 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
261 silly registry.get
etag: ‘“40UQ0TU5NYNGPQGNYQV0BYXHF”’,
261 silly registry.get
date: ‘Sat, 26 Jan :57 GMT’,
261 silly registry.get
‘content-length’: ‘0’ } ]
262 verbose etag hooks/0.2.1 from cache
263 http 304
264 silly registry.get cb [ 304,
264 silly registry.get
{ server: ‘CouchDB/1.2.1 (Erlang OTP/R15B)’,
264 silly registry.get
etag: ‘“D8DVG2H5DOK9ABLBM06DV11AA”’,
264 silly registry.get
date: ‘Sat, 26 Jan :57 GMT’,
264 silly registry.get
‘content-length’: ‘0’ } ]
265 verbose etag sliced/0.0.3 from cache
266 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\sliced\0.0.3\package\package.json
267 silly lockFile 75155ca2-sliced-0-0-3 sliced.0.3
268 verbose read json C:\Users\jiang\AppData\Roaming\npm-cache\hooks\0.2.1\package\package.json
269 silly lockFile 207ce50b-hooks-0-2-1 hooks.2.1
270 silly resolved [ { name: ‘mongodb’,
270 silly resolved
description: ‘A node.js driver for MongoDB’,
270 silly resolved
keywords: [ ‘mongodb’, ‘mongo’, ‘driver’, ‘db’ ],
270 silly resolved
version: ‘1.2.8’,
270 silly resolved
author: { name: ‘Christian Amor Kvalheim’, email: ‘’ },
270 silly resolved
contributors:
270 silly resolved
[ [Object],
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
270 silly resolved
[Object] ],
270 silly resolved
repository:
270 silly resolved
{ type: ‘git’,
270 silly resolved
url: ‘’ },
270 silly resolved
270 silly resolved
{ mail: ‘node-’,
270 silly resolved
url: ‘’ },
270 silly resolved
dependencies: { bson: ‘0.1.5’ },
270 silly resolved
devDependencies:
270 silly resolved
{ dox: ‘0.2.0’,
270 silly resolved
‘uglify-js’: ‘1.2.5’,
270 silly resolved
ejs: ‘0.6.1’,
270 silly resolved
nodeunit: ‘0.7.4’,
270 silly resolved
github3: ‘&=0.3.0’,
270 silly resolved
markdown: ‘0.3.1’,
270 silly resolved
gleak: ‘0.2.3’,
270 silly resolved
step: ‘0.0.5’,
270 silly resolved
async: ‘0.1.22’ },
270 silly resolved
config: { native: false },
270 silly resolved
main: ‘./lib/mongodb/index’,
270 silly resolved
homepage: ‘’,
270 silly resolved
directories: { lib: ‘./lib/mongodb’ },
270 silly resolved
engines: { node: ‘&=0.6.0’ },
270 silly resolved
scripts: { test: ‘make test_pure’ },
270 silly resolved
licenses: [ [Object] ],
270 silly resolved
readme: 'Up to date documentation\n========================\n\n\n\nInstall\n=======\n\nTo install the most recent release from npm, run:\n\n
npm install mongodb\n\nThat may give you a warning telling you that bugs[‘web’] should be bugs[‘url’], it would be safe to ignore it (this has been fixed in the development version)\n\nTo install the latest from the repository, run::\n\n
npm install path/to/node-mongodb-native\n\nCommunity\n=========\nCheck out the google group
for questions/answers from users of the driver.\n\nTry it live\n============\n&a href=“” target=”_blank”&&img src=“” style=“width:67height:25”&&/a&\n\nIntroduction\n============\n\nThis is a node.js driver for MongoDB. It’s a port (or close to a port) of the library for ruby at
simple example of inserting a document.\n\njavascript\n var client = new Db(\'test\', new Server(&127.0.0.1&, 27017, {}), {w: 1}),\n test = function (err, collection) {\n collection.insert({a:2}, function(err, docs) {\n\n collection.count(function(err, count) {\n test.assertEquals(1, count);\n });\n\n // Locate all the entries using find\n collection.find().toArray(function(err, results) {\n test.assertEquals(1, results.length);\n test.assertTrue(results[0].a === 2);\n\n // Let\'s close the db\n client.close();\n });\n });\n };\n\n client.open(function(err, p_client) {\n client.collection(\'test_insert\', test);\n });\n\n\nData types\n==========\n\nTo store and retrieve the non-JSON MongoDb primitives (, Long, Binary, , , Code).\n\nIn particular, every document has a unique _id which can be almost any type, and by default a 12-byte ObjectID is created. ObjectIDs can be represented as 24-digit hexadecimal strings, but you must convert the string back into an ObjectID before you can use it in the database. For example:\n\njavascript\n // Get the objectID type\n var ObjectID = require(\'mongodb\').ObjectID;\n\n var idString = \'4e4e\';\n collection.findOne({_id: new ObjectID(idString)}, console.log) // ok\n collection.findOne({_id: idString}, console.log) // wrong! callback gets undefined\n\n\nHere are the constructors the non-Javascript BSON primitive types:\n\njavascript\n // Fetch the library\n var mongo = require(\'mongodb\');\n // Create new instances of BSON types\n new mongo.Long(numberString)\n new mongo.ObjectID(hexString)\n new mongo.Timestamp() // the actual unique number is generated on insert.\n new mongo.DBRef(collectionName, id, dbName)\n new mongo.Binary(buffer) // takes a string or Buffer\n new mongo.Code(code, [context])\n new mongo.Symbol(string)\n new mongo.MinKey()\n new mongo.MaxKey()\n new mongo.Double(number)\t// Force double storage\n\n\nThe C/C++ bson parser/serializer\n--------------------------------\n\nIf you are running a version of this library has the C/C++ parser compiled, to enable the driver to use the C/C++ bson parser pass it the option native_parser:true like below\n\njavascript\n // using native_parser:\n var client = new Db(\'integration_tests_20\',\n new Server(&127.0.0.1&, 27017),\n {native_parser:true});\n\n\nThe C++ parser uses the js objects both for serialization and deserialization.\n\nGitHub information\n==================\n\nThe source code is available at
can either clone the repository or download a tarball of the latest release.\n\nOnce you have the source you can test the driver by running\n\n
$ make test\n\nin the main directory. You will need to have a mongo instance running on localhost for the integration tests to pass.\n\nExamples\n========\n\nFor examples look in the examples/ directory. You can execute the examples using node.\n\n
$ cd examples\n
$ node queries.js\n\nGridStore\n=========\n\nThe GridStore class allows for storage of binary files in mongoDB using the mongoDB defined files and chunks collection definition.\n\nFor more information have a look at \n\nReplicasets\n===========\nFor more information about how to connect to a replicaset have a look at \n\nPrimary Key Factories\n---------------------\n\nDefining your own primary key factory allows you to generate your own series of id’s\n(this could f.ex be to use something like ISBN numbers). The generated the id needs to be a 12 byte long “string”.\n\nSimple example below\n\njavascript\n // Custom factory (need to provide a 12 byte array);\n CustomPKFactory = function() {}\n CustomPKFactory.prototype = new Object();\n CustomPKFactory.createPk = function() {\n return new ObjectID(&aaaaaaaaaaaa&);\n }\n\n var p_client = new Db(\'integration_tests_20\', new Server(&127.0.0.1&, 27017, {}), {\'pk\':CustomPKFactory});\n p_client.open(function(err, p_client) {\n p_client.dropDatabase(function(err, done) {\n p_client.createCollection(\'test_custom_key\', function(err, collection) {\n collection.insert({\'a\':1}, function(err, docs) {\n collection.find({\'_id\':new ObjectID(&aaaaaaaaaaaa&)}, function(err, cursor) {\n cursor.toArray(function(err, items) {\n test.assertEquals(1, items.length);\n\n // Let\'s close the db\n p_client.close();\n });\n });\n });\n });\n });\n });\n\n\nStrict mode\n-----------\n\nEach database has an optional strict mode. If it is set then asking for a collection\nthat does not exist will return an Error object in the callback. Similarly if you\nattempt to create a collection that already exists. Strict is provided for convenience.\n\njavascript\n var error_client = new Db(\'integration_tests_\', new Server(&127.0.0.1&, 27017, {auto_reconnect: false}), {strict:true});\n test.assertEquals(true, error_client.strict);\n\n error_client.open(function(err, error_client) {\n error_client.collection(\'does-not-exist\', function(err, collection) {\n test.assertTrue(err instanceof Error);\n test.assertEquals(&Collection does-not-exist does not exist. Currently in strict mode.&, err.message);\n });\n\n error_client.createCollection(\'test_strict_access_collection\', function(err, collection) {\n error_client.collection(\'test_strict_access_collection\', function(err, collection) {\n test.assertTrue(collection instanceof Collection);\n // Let\'s close the db\n error_client.close();\n });\n });\n });\n\n\nDocumentation\n=============\n\nIf this document doesn’t answer your questions, see the source of\n\nor ,\nor the documentation at MongoDB for query and update formats.\n\nFind\n----\n\nThe find method is actually a factory method to create\nCursor objects. A Cursor lazily uses the connection the first time\nyou call nextObject, each, or toArray.\n\nThe basic operation on a cursor is the nextObject method\nthat fetches the next matching document from the database. The convenience\nmethods each and toArray call nextObject until the cursor is exhausted.\n\nSignatures:\n\njavascript\n var cursor = collection.find(query, [fields], options);\n cursor.sort(fields).limit(n).skip(m).\n\n cursor.nextObject(function(err, doc) {});\n cursor.each(function(err, doc) {});\n cursor.toArray(function(err, docs) {});\n\n cursor.rewind() // reset the cursor to its initial state.\n\n\nUseful chainable methods of cursor. These can optionally be options of find instead of method calls:\n\n* .limit(n).skip(m) to control paging.\n* .sort(fields) Order by the given fields. There are several equivalent syntaxes:\n
* .sort({field1: -1, field2: 1}) descending by field1, then ascending by field2.\n
* .sort([[\'field1\', \'desc\'], [\'field2\', \'asc\']]) same as above\n
* .sort([[\'field1\', \'desc\'], \'field2\']) same as above\n
* .sort(\'field1\') ascending by field1\n\nOther options of find:\n\n* fields the fields to fetch (to avoid transferring the entire document)\n* tailable if true, makes the cursor .\n* batchSize The number of the subset of results to request the database\nto return for every request. This should initially be greater than 1 otherwise\nthe database will automatically close the cursor. The batch size can be set to 1\nwith batchSize(n, function(err){}) after performing the initial query to the database.\n* hint See .\n* explain turns this into an explain query. You can also call\nexplain() on any cursor to fetch the explanation.\n* snapshot prevents documents that are updated while the query is active\nfrom being returned multiple times. See more\n.\n* timeout if false, asks MongoDb not to time out this cursor after an\ninactivity period.\n\n\nFor information on how to create queries, see the\n.\n\njavascript\n var mongodb = require(\'mongodb\');\n var server = new mongodb.Server(&127.0.0.1&, 27017, {});\n new mongodb.Db(\'test\', server, {}).open(function (error, client) {\n if (error)\n var collection = new mongodb.Collection(client, \'test_collection\');\n collection.find({}, {limit:10}).toArray(function(err, docs) {\n console.dir(docs);\n });\n });\n\n\nInsert\n------\n\nSignature:\n\njavascript\n collection.insert(docs, options, [callback]);\n\n\nwhere docs can be a single document or an array of documents.\n\nUseful options:\n\n* safe:true Should always set if you have a callback.\n\nSee also: .\n\njavascript\n var mongodb = require(\'mongodb\');\n var server = new mongodb.Server(&127.0.0.1&, 27017, {});\n new mongodb.Db(\'test\', server, {w: 1}).open(function (error, client) {\n if (error)\n var collection = new mongodb.Collection(client, \'test_collection\');\n collection.insert({hello: \'world\'}, {safe:true},\n function(err, objects) {\n if (err) console.warn(err.message);\n if (err && err.message.indexOf(\'E11000 \') !== -1) {\n // this _id was already inserted in the database\n }\n });\n });\n\n\nNote that there’s no reason to pass a callback to the insert or update commands\nunless you use the safe:true option. If you don’t specify safe:true, then\nyour callback will be called immediately.\n\nU update and insert (upsert)\n----------------------------------\n\nThe update operation will update the first document that matches your query\n(or all documents that match if you use multi:true).\nIf safe:true, upsert is not set, and no documents match, your callback will return 0 documents updated.\n\nSee the
for\nthe modifier ($inc, $set, $push, etc.) formats.\n\nSignature:\n\njavascript\n collection.update(criteria, objNew, options, [callback]);\n\n\nUseful options:\n\n* safe:true Should always set if you have a callback.\n* multi:true If set, all matching documents are updated, not just the first.\n* upsert:true Atomically inserts the document if no documents matched.\n\nExample for update:\n\njavascript\n var mongodb = require(\'mongodb\');\n var server = new mongodb.Server(&127.0.0.1&, 27017, {});\n new mongodb.Db(\'test\', server, {w: 1}).open(function (error, client) {\n if (error)\n var collection = new mongodb.Collection(client, \'test_collection\');\n collection.update({hi: \'here\'}, {$set: {hi: \'there\'}}, {safe:true},\n function(err) {\n if (err) console.warn(err.message);\n else console.log(\'successfully updated\');\n });\n });\n\n\nFind and modify\n---------------\n\nfindAndModify is like update, but it also gives the updated document to\nyour callback. But there are a few key differences between findAndModify and\nupdate:\n\n
1. The signatures differ.\n
2. You can only findAndModify a single item, not multiple items.\n\nSignature:\n\njavascript\n collection.findAndModify(query, sort, update, options, callback)\n\n\nThe sort parameter is used to specify which object to operate on, if more than\none document matches. It takes the same format as the cursor sort (see\nConnection.find above).\n\nSee the\n\nfor more details.\n\nUseful options:\n\n* remove:true set to a true to remove the object before returning\n* new:true set to true if you want to return the modified object rather than the original. Ignored for remove.\n* upsert:true Atomically inserts the document if no documents matched.\n\nExample for findAndModify:\n\njavascript\n var mongodb = require(\'mongodb\');\n var server = new mongodb.Server(&127.0.0.1&, 27017, {});\n new mongodb.Db(\'test\', server, {w: 1}).open(function (error, client) {\n if (error)\n var collection = new mongodb.Collection(client, \'test_collection\');\n collection.findAndModify({hello: \'world\'}, [[\'_id\',\'asc\']], {$set: {hi: \'there\'}}, {},\n function(err, object) {\n if (err) console.warn(err.message);\n else console.dir(object); // undefined if no matching object exists.\n });\n });\n\n\nSave\n----\n\nThe save method is a shorthand for upsert if the document contains an\n_id, or an insert if there is no _id.\n\nSponsors\n========\nJust as Felix Geisend?rfer I’m also working on the driver for my own startup and this driver is a big project that also benefits other companies who are using MongoDB.\n\nIf your company could benefit from a even better-engineered node.js mongodb driver I would appreciate any type of sponsorship you may be able to provide. All the sponsors will get a lifetime display in this readme, priority support and help on problems and votes on the roadmap decisions for the driver. If you are interested contact me on
for details.\n\nAnd I’m very thankful for code contributions. If you are interested in working on features please contact me so we can discuss API design and testing.\n\nRelease Notes\n=============\n\nSee HISTORY\n\nCredits\n=======\n\n1. \n2. \n3. \n\nContributors\n============\n\nAaron Heckmann, Christoph Pojer, Pau Ramon Revilla, Nathan White, Emmerman, Seth LaForge, Boris Filipov, Stefan Sch?rmeli, Tedde Lundgren, renctan, Sergey Ukustov, Ciaran Jessup, kuno, srimonti, Erik Abele, Pratik Daga, Slobodan Utvic, Kristina Chodorow, Yonathan Randolph, Brian Noguchi, Sam Epstein, James Harrison Fisher, Vladimir Dronnikov, Ben Hockey, Henrik Johansson, Simon Weare, Alex Gorbatchev, Shimon Doodkin, Kyle Mueller, Eran Hammer-Lahav, Marcin Ciszak, Fran?ois de Metz, Vinay Pulim, nstielau, Adam Wiggins, entrinzikyl, Jeremy Selier, Ian Millington, Public Keating, andrewjstone, Christopher Stott, Corey Jewett, brettkiefer, Rob Holland, Senmiao Liu, heroic, gitfy\n\nLicense\n=======\n\n Copyright 2009 - 2012 Christian Amor Kvalheim.\n\n
Licensed under the Apache License, Version 2.0 (the “License”);\n
you may not use this file except in compliance with the License.\n
You may obtain a copy of the License at\n\n
Unless required by applicable law or agreed to in writing, software\n
distributed under the License is distributed on an “AS IS” BASIS,\n
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n
See the License for the specific language governing permissions and\n
limitations under the License.\n\n’,
270 silly resolved
readmeFilename: ‘’,
270 silly resolved
_id: ‘mongodb.2.8’,
270 silly resolved
_from: ‘mongodb.2.8’ },
270 silly resolved
{ name: ‘ms’,
270 silly resolved
version: ‘0.1.0’,
270 silly resolved
description: ‘Tiny ms conversion utility’,
270 silly resolved
main: ‘./ms’,
270 silly resolved
devDependencies: { mocha: ‘’, ‘expect.js’: '’, serve: ‘*’ },
270 silly resolved
readme: ‘\n# ms.js\n\nEver find yourself doing math in your head or writing 1000 * 60 * 60 …?\nDon’t want to add obstrusive Number prototype extensions to your reusable\n/ distributable modules and projects?\n\nms is a tiny utility that you can leverage when your application needs to\naccept a number of miliseconds as a parameter.\n\nIf a number is supplied to ms, it returns it immediately (e.g:\nIf a string that contains the number is supplied, it returns it immediately as\na number (e.g: it returns 100 for \'100\').\n\nHowever, if you pass a string with a number and a valid unit, hte number of\nequivalent ms is returned.\n\njs\nms(\'1d\') // \nms(\'10h\') // \nms(\'2h\') // 7200000\nms(\'1m\') // 60000\nms(\'5ms\') // 5000\nms(\'100\') // \'100\'\nms(100) // 100\n\n\n## How to use\n\n### Node\n\njs\nrequire(\'ms\')\n\n\n### Browser\n\nhtml\n&script src=&ms.js&&&/script&\n\n\n## Credits\n\n(The MIT License)\n\nCopyright (C) 2011 Guillermo Rauch &&\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n’Software’), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n’,
270 silly resolved
readmeFilename: ‘’,
270 silly resolved
_id: ‘ms.1.0’,
270 silly resolved
_from: ‘ms.1.0’ },
270 silly resolved
{ name: ‘muri’,
270 silly resolved
version: ‘0.1.0’,
270 silly resolved
description: ‘MongoDB URI parser’,
270 silly resolved
main: ‘index.js’,
270 silly resolved
scripts: { test: ‘make test’ },
270 silly resolved
repository: { type: ‘git’, url: ‘git:///aheckmann/muri.git’ },
270 silly resolved
keywords: [ ‘mongodb’, ‘uri’, ‘parser’ ],
270 silly resolved
270 silly resolved
{ name: ‘Aaron Heckmann’,
270 silly resolved
email: ‘aaron.’ },
270 silly resolved
license: ‘MIT’,
270 silly resolved
devDependencies: { mocha: ‘1.6.0’ },
270 silly resolved
readme: ‘#Meet Muri!\n\nMuri is your friendly neighborhood
parser for Node.js.\n\n\n###Install\n\n
$ npm install muri\n\n###Use\n\njs\n var muri = require(\'muri\');\n var o = muri(\'mongodb://user:pass[@local](/user/local),remote:27018,japan:27019/neatdb?replicaSet=myreplset&journal=true&w=2&wtimeoutMS=50\');\n\n console.log(o);\n\n { hosts: [ { host: \'local\', port: 27017 },\n { host: \'remote\', port: 27018 },\n { host: \'japan\', port: 27019 } ],\n db: \'neatdb\',\n options: {\n replicaSet: \'myreplset\',\n journal: true,\n w: 2,\n wtimeoutMS: 50\n },\n auth: {\n user: \'user\',\n pass: \'pass\'\n }\n }\n\n\n### Details\n\nThe returned object contains the following properties:\n\n- db: the name of the database. defaults to “admin” if not specified\n- auth: if auth is specified, this object will exist { user: \'username\', pass: \'password\' }\n- hosts: array of host/port objects, one for each specified [{ host: \'local\', port: 27107 }, { host: \'..\', port: port }]\n
- if a port is not specified for a given host, the default port (27017) is used\n
- if a unix domain socket is passed, host/port will be undefined and ipc will be set to the value specified [{ ipc: \'/tmp/mongodb-27017\' }]\n- options: this is a hash of all options specified in the querystring\n\n\n’,
270 silly resolved
readmeFilename: ‘’,
270 silly resolved
_id: ‘muri.1.0’,
270 silly resolved
from: ‘muri.1.0’ },
270 silly resolved
{ name: ‘sliced’,
270 silly resolved
version: ‘0.0.3’,
270 silly resolved
description: ‘A faster Node.js alternative to Array.prototype.slice.call(arguments)’,
270 silly resolved
main: ‘index.js’,
270 silly resolved
scripts: { test: ‘make test’ },
270 silly resolved
repository: { type: ‘git’, url: ‘git:///aheckmann/sliced’ },
270 silly resolved
keywords: [ ‘arguments’, ‘slice’, ‘array’ ],
270 silly resolved
270 silly resolved
{ name: ‘Aaron Heckmann’,
270 silly resolved
email: ‘aaron.’ },
270 silly resolved
license: ‘MIT’,
270 silly resolved
devDependencies: { mocha: ‘1.5.0’, benchmark: ‘~1.0.0’ },
270 silly resolved
readme: '#sliced\n==========\n\nA faster alternative to [].slice.call(arguments).\n\n\n\nExample output from \n\n
Array.prototype.slice.call x 1,320,205 ops/sec ±2.35% (92 runs sampled)\n
[].slice.call x 1,314,605 ops/sec ±1.60% (95 runs sampled)\n
cached slice.call x 10,468,380 ops/sec ±1.45% (95 runs sampled)\n
sliced x 16,608,237 ops/sec ±1.40% (92 runs sampled)\n
fastest is sliced\n\n
Array.prototype.slice.call(arguments, 1) x 1,383,584 ops/sec ±1.73% (97 runs sampled)\n
[].slice.call(arguments, 1) x 1,494,735 ops/sec ±1.33% (95 runs sampled)\n
cached slice.call(arguments, 1) x 10,085,270 ops/sec ±1.51% (97 runs sampled)\n
sliced(arguments, 1) x 16,620,480 ops/sec ±1.29% (95 runs sampled)\n
fastest is sliced(arguments, 1)\n\n
Array.prototype.slice.call(arguments, -1) x 1,303,262 ops/sec ±1.62% (94 runs sampled)\n
[].slice.call(arguments, -1) x 1,325,615 ops/sec ±1.36% (97 runs sampled)\n
cached slice.call(arguments, -1) x 9,673,603 ops/sec ±1.70% (96 runs sampled)\n
sliced(arguments, -1) x 16,384,575 ops/sec ±1.06% (91 runs sampled)\n
fastest is sliced(arguments, -1)\n\n
Array.prototype.slice.call(arguments, -2, -10) x 1,404,390 ops/sec ±1.61% (95 runs sampled)\n
[].slice.call(arguments, -2, -10) x 1,514,367 ops/sec ±1.21% (96 runs sampled)\n
cached slice.call(arguments, -2, -10) x 9,836,017 ops/sec ±1.21% (95 runs sampled)\n
sliced(arguments, -2, -10) x 18,544,882 ops/sec ±1.30% (91 runs sampled)\n
fastest is sliced(arguments, -2, -10)\n\n
Array.prototype.slice.call(arguments, -2, -1) x 1,458,604 ops/sec ±1.41% (97 runs sampled)\n
[].slice.call(arguments, -2, -1) x 1,536,547 ops/sec ±1.63% (99 runs sampled)\n
cached slice.call(arguments, -2, -1) x 10,060,633 ops/sec ±1.37% (96 runs sampled)\n
sliced(arguments, -2, -1) x 18,608,712 ops/sec ±1.08% (93 runs sampled)\n
fastest is sliced(arguments, -2, -1)\n\n_Benchmark
.\n\n##Usage\n\nsliced accepts the same arguments as Array#slice so you can easily swap it out.\n\njs\nfunction zing () {\n var slow = [].slice.call(arguments, 1, 8);\n var args = slice(arguments, 1, 8);\n\n var slow = Array.prototype.slice.call(arguments);\n var args = slice(arguments);\n // etc\n}\n\n\n## install\n\n
npm install sliced\n\n\n\n’,
270 silly resolved
readmeFilename: ‘’,
270 silly resolved
_id: ‘sliced.0.3’,
270 silly resolved
_from: ‘sliced.0.3’ },
270 silly resolved
{ name: ‘hooks’,
270 silly resolved
description: ‘Adds pre and post hook functionality to your JavaScript methods.’,
270 silly resolved
version: ‘0.2.1’,
270 silly resolved
keywords: [ ‘node’, ‘hooks’, ‘middleware’, ‘pre’, ‘post’ ],
270 silly resolved
homepage: ‘’,
270 silly resolved
repository: { type: ‘git’, url: ‘git:///bnoguchi/hooks-js.git’ },
270 silly resolved
270 silly resolved
{ name: ‘Brian Noguchi’,
270 silly resolved
email: ‘’,
270 silly resolved
url: ‘’ },
270 silly resolved
main: ‘./hooks.js’,
270 silly resolved
directories: { lib: ‘.’ },
270 silly resolved
scripts: { test: ‘make test’ },
270 silly resolved
dependencies: {},
270 silly resolved
devDependencies: { expresso: ‘&=0.7.6’, should: ‘&=0.2.1’, underscore: ‘&=1.1.4’ },
270 silly resolved
engines: { node: ‘&=0.4.0’ },
270 silly resolved
licenses: [ ‘MIT’ ],
270 silly resolved
optionalDependencies: {},
270 silly resolved
readme: ‘hooks\n============\n\nAdd pre and post middleware hooks to your JavaScript methods.\n\n## Installation\n
npm install hooks\n\n## Motivation\nSuppose you have a JavaScript object with a save method.\n\nIt would be nice to be able to declare code that runs before save and after save.\nFor example, you might want to run validation code before every save,\nand you might want to dispatch a job to a background job queue after save.\n\nOne might have an urge to hard code this all into save, but that turns out to\ncouple all these pieces of functionality (validation, save, and job creation) more\ntightly than is necessary. For example, what if someone does not want to do background\njob creation after the logical save? \n\nIt is nicer to tack on functionality using what we call pre and post hooks. These\nare functions that you define and that you direct to execute before or after particular\nmethods.\n\n## Example\nWe can use hooks to add validation and background jobs in the following way:\n\n
var hooks = require(‘hooks’)\n
, Document = require(’./path/to/some/document/constructor’);\n\n
// Add hooks’ methods: hook, pre, and post
for (var k in hooks) {\n
Document[k] = hooks[k];\n
// Define a new method that is able to invoke pre and post middleware\n
Document.hook(‘save’, Document.prototype.save);\n\n
// Define a middleware function to be invoked before ‘save’\n
Document.pre(‘save’, function validate (next) {\n
// The this context inside of pre and post functions\n
// is the Document instance\n
if (this.isValid()) next();
// next() passes control to the next middleware\n
// or to the target method itself\n
else next(new Error(“Invalid”)); // next(error) invokes an error callback\n
// Define a middleware function to be invoked after ‘save’\n
Document.post(‘save’, function createJob () {\n
this.sendToBackgroundQueue();\n
});\n\nIf you already have defined Document.prototype methods for which you want pres and posts,\nthen you do not need to explicitly invoke Document.hook(...). Invoking Document.pre(methodName, fn)\nor Document.post(methodName, fn) will automatically and lazily change Document.prototype[methodName]\nso that it plays well with hooks. An equivalent way to implement the previous example is:\n\njavascript\nvar hooks = require(\'hooks\')\n , Document = require(\'./path/to/some/document/constructor\');\n\n// Add hooks\' methods: `hook`, `pre`, and `post` \nfor (var k in hooks) {\n Document[k] = hooks[k];\n}\n\nDocument.prototype.save = function () {\n // ...\n};\n\n// Define a middleware function to be invoked before \'save\'\nDocument.pre(\'save\', function validate (next) {\n // The `this` context inside of `pre` and `post` functions\n // is the Document instance\n if (this.isValid()) next(); // next() passes control to the next middleware\n // or to the target method itself\n else next(new Error(&Invalid&)); // next(error) invokes an error callback\n});\n\n// Define a middleware function to be invoked after \'save\'\nDocument.post(\'save\', function createJob () {\n this.sendToBackgroundQueue();\n});\n\n\n## Pres and Posts as Middleware\nWe structure pres and posts as middleware to give you maximum flexibility:\n\n1. You can define multiple pres (or posts) for a single method.\n2. These pres (or posts) are then executed as a chain of methods.\n3. Any functions in this middleware chain can choose to halt the chain’s execution by nexting an Error from that middleware function. If this occurs, then none of the other middleware in the chain will execute, and the main method (e.g., save) will not execute. This is nice, for example, when we don’t want a document to save if it is invalid.\n\n## Defining multiple pres (or posts)\npre is chainable, so you can define multiple pres via:\n
Document.pre(‘save’, function (next, halt) {\n
console.log(“hello”);\n
}).pre(‘save’, function (next, halt) {\n
console.log(“world”);\n
});\n\nAs soon as one pre finishes executing, the next one will be invoked, and so on.\n\n## Error Handling\nYou can define a default error handler by passing a 2nd function as the 3rd argument to hook:\n
Document.hook(‘set’, function (path, val) {\n
this[path] =\n
}, function (err) {\n
// Handler the error here\n
console.error(err);\n
});\n\nThen, we can pass errors to this handler from a pre or post middleware function:\n
Document.pre(‘set’, function (next, path, val) {\n
next(new Error());\n
});\n\nIf you do not set up a default handler, then hooks makes the default handler that just throws the Error.\n\nThe default error handler can be over-rided on a per method invocation basis.\n\nIf the main method that you are surrounding with pre and post middleware expects its last argument to be a function\nwith callback signature function (error, ...), then that callback becomes the error handler, over-riding the default\nerror handler you may have set up.\n
\njavascript\nDocument.hook(\'save\', function (callback) {\n // Save logic goes here\n ...\n});\n\nvar doc = new Document();\ndoc.save( function (err, saved) {\n // We can pass err via `next` in any of our pre or post middleware functions\n if (err) console.error(err);\n \n // Rest of callback logic follows ...\n});\n\n\n## Mutating Arguments via Middleware\npre and post middleware can also accept the intended arguments for the method\nthey augment. This is useful if you want to mutate the arguments before passin}

我要回帖

更多关于 no test found 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信