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
0
votes
2 answers

The new:true option returns me the old value in MongoDB

I'm using the following code in MongoDB v2.2 NodeJS 0.8 MongoSkin 0.5 Framework: var db = mongo.db(admin+"@127.0.0.1:27017/database",{safe:true}); db.collection('collection').findAndModify({'code':code,'email':email},[], { $push: …
andrescabana86
  • 1,778
  • 8
  • 30
  • 56
0
votes
1 answer

how can i know if connection is safe true?

i made many times questions about connections on mongodb, i cant understand many things yet, but i try... with this connection... db.collection('usuarios').insert(campos,{safe:true}, function(err, result) i get a safe connection.... but mongodb…
andrescabana86
  • 1,778
  • 8
  • 30
  • 56
0
votes
1 answer

Can't return a string properly with mongoskin

So I have this script: var db = require('mongoskin').db('localhost:27017/titles', {safe:true}); var titles = db.collection('titles'); title = titles.findOne(function(err, result){ if (err) throw err; return…
user1816679
  • 845
  • 3
  • 11
  • 19
0
votes
1 answer

Mocking mongoskin in node.js application

As I try to follow the TDD way of development, I still struggle to find out how one can mock certain stuff in JavaScript. I am used to mocking in Java with Mockito and Spring (e.g. inject a mongo mock instead of a real mongo instance), but how do I…
rit
  • 2,308
  • 3
  • 19
  • 27
0
votes
1 answer

How to protect against sql injection with url.parse

I am very new to node.js and mongodb. I have a page getting query strings with var queries = url.parse(req.url,true).query; and I write them into database using mongoskin module. Do I have to do something against sql injection?
egiray
  • 1,169
  • 1
  • 12
  • 17
0
votes
2 answers

How to use a list of objects inside an object of MongoDB using Mongo-Skin?

I'm using mongoDB with mongoskin on top of Node.JS. I have a list of images (collection 'images') and for each image I'd like to save a list of comments. I believe the right way with mongodb is to use a list of comments inside of each Image…
Roman
  • 4,443
  • 14
  • 56
  • 81
0
votes
1 answer

Reconnect MongoDB using MongoSkin ( Nodejs )

I have been using MongoSkin( Nodejs ) plugin to connect Mongodb as below. var db = mongo.db(dbconfig.mongo_ip+'/'+dbconfig.mongo_db_name); db.collection('myprofile').findOne({_id:memberid}, function(err, session){ if(err){ …
Raja
  • 3,477
  • 12
  • 47
  • 89
0
votes
0 answers

Foreman + NodeJS + MongoSkin: How to connect to mongodb from mongo cli?

I have a simple helloworld project using foreman + nodejs + mongoskin. It's acquire some data from an http get request and put it into mongodb via mongoskin. The app works but I'm not able to connect to the db with the mongo cli. When I start it…
devmao
  • 670
  • 8
  • 18
-1
votes
1 answer

NodeJS MongoDb $sort not working in aggregate query

I have created a GET api for results, with filters, pagination and sorting. But though the data is correct, the sorting is not happening correctly. let skip = 0, limit = 10, findCond = {centerId:…
-1
votes
1 answer

What's keyword about repeat $addtoset in mongodb by mongoskin ( I read english a little)

Sorry, I can't find answer and I can't read english. What's keyword can find answer about the following example code ? for(var value in row){ db.collection('testdb').update({_id:'id'},{$addToSet:value}, …
user2468652
  • 117
  • 1
  • 9
-1
votes
1 answer

Displaying data from mongoskin through HTML

I am using mongodb to store data and i wrote a simple js script using mongoskin to query and retrieve data from a collection and it works fine... var db = require('mongoskin').db('winter.ceit.uq.edu.au/openbeacon'); var time = 0; var tagid =…
-2
votes
1 answer

Mongoskin connection to mongodb with node js

Am trying to connect to mongodb throw my node js app using this line: const db = mongoskin.db("mongodb://localhost:27017/todo?auto_reconnect", {safe:true}); but it always gives me error: And here screen shot from my code sample: