Questions tagged [mongoskin]

MongoSkin is an easy to use Node.js driver for MongoDB. It builds on the `node-mongodb-native` driver with support for additional JavaScript method binding which allows it to act as a Model (in a document way).

MongoSkin is an easy to use Node.js driver for MongoDB. It builds on the node-mongodb-native driver with support for additional JavaScript method binding which allows it to act as a Model (in a document way).

Installing/upgrading

$ npm install mongoskin

Documentation

178 questions
74
votes
10 answers

Iterating over a mongodb cursor serially (waiting for callbacks before moving to next document)

Using mongoskin, I can do a query like this, which will return a cursor: myCollection.find({}, function(err, resultCursor) { resultCursor.each(function(err, result) { } } However, I'd like to call some async functions for each…
UpTheCreek
  • 31,444
  • 34
  • 152
  • 221
7
votes
1 answer

MongoDB connections keep increasing

I keep hitting my connection limit, but http traffic has remained consistent. I used MMS to profile my mongod process and saw that the number of connections keeps rising: I'm using the mongoskin wrapper for Node.js (Express). I have a piece of…
Jonathan Drake
  • 270
  • 1
  • 4
  • 13
6
votes
1 answer

MongoError: driver is incompatible with this server version

I've just installed Mongo, Node, etc. and when I try to update the database via my nodejs server, I get this error: MongoError: driver is incompatible with this server version Here are the versions I have: Node v0.12.2 (latest is v0.12.3) Express…
Katie
  • 45,622
  • 19
  • 93
  • 125
6
votes
3 answers

How to check if Mongo's $addToSet was a duplicate or not

I am using Mongoskin + NodeJS to add new keywords to MongoDB. I want to notify the user that the entry was a duplicate but not sure how to do this. /* * POST to addkeyword. */ router.post('/addkeyword', function(req, res) { var db =…
davegallant
  • 533
  • 8
  • 27
5
votes
3 answers

Mongodb not returning specific fields

I am trying to return only one field sessions from a document. I'm using the current query (it returns the entire document): yield users.findOne({ '_id': id // var id holds object id ObjectId("560ae1dc53cb3222679430f1") }, { '_id': 0, //…
basickarl
  • 37,187
  • 64
  • 214
  • 335
5
votes
1 answer

Does run mongoskin only with mongodb version 1.4 and older?

I'm trying to understand nodejs, express and mongodb I'm running mongodb v 2.0.6 and latest nodejs and express and trying to connect express application with mongodb through mongoskin. the problem is: npm ERR! peerinvalid The package mongodb does…
Marat
  • 327
  • 1
  • 2
  • 10
5
votes
3 answers

Node.js promises with mongoskin

I'm trying to avoid using callbacks when making mongodb queries. I'm using mongoskin to make calls like so: req.db.collection('users').find().toArray(function (err, doc) { res.json(doc); }); In many cases I need to make multiple queries so I want…
Rob
  • 10,851
  • 21
  • 69
  • 109
5
votes
2 answers

Updating an array item using NodeJS, MongoDB & Monk

I have a data set like this: { name : 'Doc Name', photos: [ { name: 'photo1', url: 'http://.....' }, { name: 'photo2', url: 'http://......' } ], etc ... Using Monk…
Ryan Knell
  • 6,204
  • 2
  • 40
  • 32
4
votes
1 answer

Get inserted Ids for Bulk.Insert() -Mongoskin

I am using a mongoskin in my nodeJs applicatipon to insert data in mongo db. I have a requirement to insert array of documents in database and send back the Ids of inserted records to the client. I am able to insert data however unable to locate the…
Kavya Mugali
  • 1,008
  • 2
  • 10
  • 17
4
votes
2 answers

mongodb node.js finding document with multiple Ids present in an Array

I have an array which contains Id of a mongodb collection array = [ '573163a52abda310151e5791', '57358e5dbd2f8b960aecfa8c', '573163da2abda310151e5792' ] like this, in my nodejs code I want to find the documents of all these Ids.…
Ankit
  • 520
  • 7
  • 21
4
votes
2 answers

Passing query conditions to db.collection.find in Node.js/Mongodb where the query string is generated

I am trying to build a NodeJS/mongodb application, where when I read a request which contains either (XYZ > 10) OR (XYZ < 15). I would like to generate a query string on the go. And then do a search in a certain Mongodb Collection. The following…
DJ0073
  • 43
  • 1
  • 5
4
votes
5 answers

DB connection error handling with monk

I am using monk on a code that looks like var monk = require('monk') var db = monk('localhost/mydb') if(!db){ console.log('no connection') } when I run it, console logs 'no connection', but I would like to know why it is not connecting, (maybe…
Alloys
  • 143
  • 1
  • 11
4
votes
1 answer

MongoDb unique constraints on a Date range

Im using MongoDb with Mongoskin. In a collection I'm saving events. Among other fields, these events have a start and an end, saved as Dates in Mongodb. events { start: "Date1", end: "Date2", ... } When inserting new documents in this…
Anders Östman
  • 3,702
  • 4
  • 26
  • 48
4
votes
3 answers

Mongoskin findAndModify ID object id

Using nodejs, mongoskin.. I'd like to return the updated doc so Im using findAndModify, however the query {_id: "someid"} doesn't work. I think I need to use {id: ObjectID{'someid'} as the query. How do I get the ObjectId type into JS?
C B
  • 12,482
  • 5
  • 36
  • 48
3
votes
1 answer

MongoSkin "Cannot read property 'apply' of undefined"

I'm trying to use MongoSkin in NodeJS, and I have this code: var mongoskin = require('mongoskin'); var db = mongoskin.db("mongodb://localhost:27017/database"); var collection = db.collection('test'); collection.find().toArray(function(err, items)…
Ethanol
  • 370
  • 6
  • 18
1
2 3
11 12