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
1
vote
1 answer

What is the addressing issue with my complex document update() in MongoDB?

I have been unable to reach into my MongoDB collection and change a value in a complex document. I have tried more variations than the one example shown below, all sorts of variations, but they fail. I want to change the Value of the Key "air" from…
Ric
  • 796
  • 12
  • 28
1
vote
0 answers

nodejs not terminate after db.close()

My node script not terminates even though I tried to close all my connections. Of course I can terminate it with process.exit, but I want to know what the reason behind this. The wtfnode plugin showed I have a lot of open mongo connections. It seems…
Paxi
  • 111
  • 11
1
vote
0 answers

MongoDB geoNear query returns wrong distance

I am getting wrong distance using mongodb geonear query. What I have done till now. Saved the lat-long as "Coordinates" : { "Longitude" : 174.811937, "Latitude" : -36.880177 } Created 2d Index on Coordinates field of collection distance…
user7420795
  • 199
  • 1
  • 15
1
vote
0 answers

MongoDB - addToSet/push only on upsert

I would like to add a subdocument to an array if it doesn't already exist and then return the newly added subdocument (or at least the array of subdocuments) within one query. Here is an example document structure: { "name": "John Smith", …
1
vote
1 answer

Inserting a JSON variable

My code is below: req.on('data', function(chunk) { console.log(JSON.stringify(chunk.toString('utf8'))); db.collection('collectionname').insert(chunk.toString('utf8'), function(err, result) { if (err) throw err; if (result)…
Courage
  • 543
  • 5
  • 25
1
vote
1 answer

nodejs and mongoskin, callback after all items have been saved

I have the following piece of code where I iterate through a collection and do another db query and construct an object within its callback. Finally I save that object to another collection. I wish to call another function after all items have been…
Alistair
  • 621
  • 1
  • 7
  • 22
1
vote
1 answer

Video from Mongo Grid fs is not playing on Safari browser (also on Cordova app)

I am using Mongodb to store video files as grid fs. It surprised me today when I came to know that video is not playing on Safari browser. However video read from Gridfs is playing fine on Chrome & Firefox. Following are two approach to read video…
joy
  • 3,669
  • 7
  • 38
  • 73
1
vote
2 answers

Example code to use GridFS using mongoskin to upload file from form

I am using mongoskin to connect mongodb in my project. Now I have requirement to use GridFs to upload images, audio etc. I have one HTML form to upload these files. I tried to find out example code to upload file using mongoskin however could't…
joy
  • 3,669
  • 7
  • 38
  • 73
1
vote
1 answer

NodeJs MongoDB Nested Queries - Run Callback Synchronously

I have a code block like below. I could not find how to achieve that. - I have rooms collection in mongodb and documents in this collection include user id array. Each room can have multiple users. - So I want to find that usernames which are in the…
baris usanmaz
  • 839
  • 1
  • 13
  • 31
1
vote
1 answer

Valid geoNear aggregate query returns nothing in Mongoskin

I've been building a small API in Express and Mongoskin. I added a simple aggregrate geoNear query to respond to params given. The server returns 200 and I get no error. I know that I'm pointing to the right collection and everything, and when I run…
JeffLuppes
  • 169
  • 1
  • 13
1
vote
1 answer

MongoDb/Mongoskin - CLEANLY Update entire document w/o specifying properties

All the examples I have seen for MongoDb & Mongoskin for update, have individual properties being updated, like so: // this works when I specify the properties db.collection('User').update({_id: mongoskin.helper.toObjectID(user._id)}, …
user1177440
1
vote
0 answers

Bluebird promises in nodejs

I have a chain of promises in nodejs. They look like this: codecommon.db.executeDbCommandAsync({ 'aggregate':'table1', pipeline:[ {$match:{uid:uid}}, {$match…
1
vote
0 answers

mongodb : Pop only single instance of a particular value

I have pushed so many same values in a single array of a mongodb document, likewise following document row //var posts_document = {_id: '54ab8d71f8ab49ac10e64125', comment_ids: ['1','2','3','1','2','1'], is_delete: 0, status: 1}; I'd like to pop…
Dineshaws
  • 2,065
  • 16
  • 26
1
vote
1 answer

Mongodb: how to return elements of array that are present in the query list

I have a collection called shops. Structure is like: [ { '_id' : id1, 'details' : {name: 'shopA'}, 'products' : [{ _id: 'p1', details: { 'name': 'product1' …
Kop4lyf
  • 4,520
  • 1
  • 25
  • 31
1
vote
1 answer

MongoSkin wrong insertion

I have an array with countries with the following structure: { "code": "ZW", "name": "Zimbabwe", "zipPattern": "[\\s\\S]*", "states": [ { "name": "Bulawayo" }, { "name": "Harare" …
Pavel
  • 1,278
  • 2
  • 17
  • 34