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

179 questions
66
votes
9 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
  • 28,433
  • 31
  • 143
  • 214
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
  • 37,767
  • 18
  • 80
  • 110
6
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
  • 260
  • 1
  • 3
  • 12
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
  • 307
  • 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
  • 8,480
  • 15
  • 58
  • 102
5
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
  • 476
  • 7
  • 25
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
  • 5,074
  • 2
  • 31
  • 28
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
  • 748
  • 2
  • 7
  • 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
  • 500
  • 4
  • 21
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
  • 112
  • 1
  • 8
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?
John Williams
  • 9,282
  • 4
  • 33
  • 44
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
  • 460
  • 3
  • 17
3
votes
2 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
  • 25,903
  • 43
  • 172
  • 270
3
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
  • 33
  • 1
  • 5
3
votes
1 answer

closing mongodb connection and get correct results with multiple parallel asynchronous query

I am new to Mongo and Node. I am currently using Mongoskin and Bluebird to handle the db connection and queries (as suggested here: https://stackoverflow.com/a/23687958/2701348 ). I have three collections: Users, Binders and Cards. The Binders…
Niko Zarzani
  • 1,282
  • 2
  • 14
  • 28
1
2 3
11 12