Thomas Watson Steen
8945d41044
Insert space before function opening bracket
9 years ago
Thomas Watson Steen
e7146c8237
Remove semicolons
9 years ago
saintedlama
2f0c62ba40
Remove superfluous ;
9 years ago
Dustin Blackman
c9025bb6ff
add support for SCRAM-SHA-1 auth mechanism.
9 years ago
Eduardo Sorribas
63496e8075
Expose ObjectId in module.
10 years ago
Prabhu Subramanian
c1d9449d85
Cleanup. Removed unused vars and imports
10 years ago
Eduardo Sorribas
0324967490
mongodb-core rewrite.
10 years ago
Eduardo Sorribas
0cddc6eec1
Allow to call bulk.update() without callback. Fixes #166 .
10 years ago
Eduardo Sorribas
35018a7ee1
added cursor.readPref.
10 years ago
Eduardo Sorribas
9d01685ce2
Add dropIndexes.
10 years ago
Eduardo Sorribas
6d331ce09d
Make aggregate return a stream. Fixes #154 .
10 years ago
Eduardo Sorribas
e708924d24
Emit error on connection error. Closes #149
10 years ago
Eduardo Sorribas
a025aa238f
Add support for bulk updates. Refs #152
10 years ago
Eduardo Sorribas
94622bec0c
If we receive a mongojs instance we connect and recreate the instance,
so we can have the collections passed in the call to mongojs.
10 years ago
Eduardo Sorribas
940dff5018
Add support to pass a driver db or a mongojs db instead of the connection string.
10 years ago
Eduardo Sorribas
b5c140c14e
ocd.
10 years ago
Eduardo Sorribas
d42d7a0c3c
Restructure the group function to multiple lines.
10 years ago
Eduardo Sorribas
f46c14e19c
Give me some space.
10 years ago
Eduardo Sorribas
a16dd33e2c
Minor refactor.
10 years ago
Eduardo Sorribas
da252d98e2
Stop using err.lastErrorObject (it's not in the driver anymore).
10 years ago
Eduardo Sorribas
c6e8f5c6cf
Collection proxy with harmony.
11 years ago
Mathias Buus
20e4b33a95
ensure optional callbacks for write ops. cc #135
11 years ago
Eduardo Sorribas
2bdd19b44e
Stop inhereting collection prototype methods. Fixes #132 .
11 years ago
Eduardo Sorribas
809252cd0e
Stop inhereting db prototype methods. Refs #132 .
11 years ago
Eduardo Sorribas
536743fe89
Rename prototypes.
11 years ago
Eduardo Sorribas
a802934cfa
Change cursor appply method to support mongo driver 1.4.0. Refs #126 #105
11 years ago
Eduardo Sorribas
20cf5eeb4a
Add support for cursor.rewind. Closes #131
11 years ago
Eduardo Sorribas
4de6a44805
Add the cursor.size method
11 years ago
Eduardo Sorribas
d1436ff084
Add missing semicolon
11 years ago
Eduardo Sorribas
a3e50ef13b
Add the cursor.map function
11 years ago
Thomas Watson Steen
649647c98e
Extract lastErrorObject from the err argument if findAndModify fails
If findAndModify experiences an error, the obj argument to the callback
is undefined. Instead the lastErrorObject is attached to the err
argument, from where we extract it.
To not rely on the lastErrorObject ALWAYS being on the err object if
provided, we gracefully fall back to looking in the obj object and then
finally just return { n: 0 } if no lastErrorObject is found. This could
be a more strict algorihm, but this seems more future-proof.
11 years ago
Eduardo Sorribas
a6a8f14970
Fix the remove callback parameters.
11 years ago
Eduardo Sorribas
0f95a380f4
lastErrorObject on all the write functions.
11 years ago
Eduardo Sorribas
6ff4158a7c
Add missing error handling
11 years ago
Mirza Kapetanovic
c3b43a9852
Removed debug code
11 years ago
Eduardo Sorribas
27ad374fa3
Change the insert callback to make it more intuitive.
- If the function was called with an array, the callback will have an array (even if the array had one element).
- If it was called with an object, the callback will have an object.
11 years ago
Eduardo Sorribas
873cf5d211
Add the lastErrorObject to the .save callback. Now the callbacks are as following.
db.users.insert(document, callback); // => callback(err, [document])
db.users.save(document, callback); // => callback(err, document, lastErrorObject)
db.users.update({ ... }, { ... }, callback); // => callback(err, lastErrorObject)
db.users.remove({ ... }, callback); // => callback(err, {n: amountRemoved})
db.users.findAndModify({ query: { ... }, update: { ... }}, callback); // => callback(err, document, lastErrorObject)
11 years ago
Eduardo Sorribas
1c1dbd501d
Change normalized callback arguments.
After this commit the callbacks for the write functions are as follows.
```
db.users.insert(document, callback); // => callback(err, [document])
db.users.save(document, callback); // => callback(err, document)
db.users.update({ ... }, { ... }, callback); // => callback(err, lastErrorObject)
db.users.remove({ ... }, callback); // => callback(err, {n: amountRemoved})
db.users.findAndModify({ query: { ... }, update: { ... }}, callback); // => callback(err, document, lastErrorObject)
```
The reason for these changes is that sometimes you might want to save a document and retrieve the
ObjectId it was saved with.
The problem of `save` returning '1' when the operation was an update is solved
here, and a test case was added for this as well.
11 years ago
Mirza Kapetanovic
014b5d17c2
Normalize lastErrorObject
11 years ago
Mirza Kapetanovic
3e0fa8c8a5
Normalize callback arguments. Same as shell.
11 years ago
Mirza Kapetanovic
fa37e1f486
Fix query included in database name
11 years ago
Mathias Buus
80bc3eb75c
added toString for database and collection
11 years ago
Mathias Buus
06bbf02b67
expose bson types visible in the shell using the shell names. fixes #99
f
11 years ago
Eduardo Sorribas
fde3f56ef6
Avoid getIndexes crash when called with no parameters.
11 years ago
RG72
0a637ffb93
index.js Emit ready event, when db connected
Emit ready event. I work with gridFs, and i need MongoDb object(MongoJS.client)
11 years ago
Mathias Buus
d91831f5b1
always closing in shutdown. see #93
11 years ago
Mathias Buus
172deed547
minor style tweaks
11 years ago
Eduardo Sorribas
1919c31057
Manage the sutdown command.
11 years ago
Eduardo Sorribas
1083ba006c
Delete unnecessary(and ugly) semicolon.
11 years ago
Mathias Buus
8e9c97f137
createCollection should throw if col exists. Fixes #44
11 years ago