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
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,372
  • 2
  • 15
  • 28
3
votes
1 answer

What's wrong with this mongoskin aggregation command?

I have a mongodb/mongoskin aggregation request as follows: db.collection(customerTable + '_earnedinfluencers').aggregate([ { $group: { _id: '$user', name: '', // to be filled separately username: '',…
jeebface
  • 841
  • 1
  • 12
  • 29
3
votes
0 answers

Mongoskin 1.4.4: Setting batchSize in an aggregation query

One of the changes in the latest MongoDB release (2.6) results in the cursor being returned by an aggregation query. This is very useful, as it allows more efficient processing of very large query result sets. I have troubles utilising this in my…
macdab
  • 31
  • 2
3
votes
1 answer

Mongodb + nodejs mongoskin update not working

I'm having issues updating a doc through Node + Express and Mongodb via Mongoskin. I used the following via the mongo command line and it works as expected: db.userlist.update({_id: ObjectId('5377821219f21e974150bacf')}, {$set: {username:…
Linkandzelda
  • 611
  • 14
  • 24
3
votes
1 answer

How to get a instance of db from node-mongo native driver?

Consider, I have MongoDB connection opened in the main app.js file itself and the following code fall in it's call back: mongodb.connect('MongoDBUrlGoesHere', function (err, db) { app.listen(app.get('port'), function AppListnCB() { …
Amol M Kulkarni
  • 21,143
  • 34
  • 120
  • 164
3
votes
2 answers

Update document only if it is different from the database?

I have a document in a mongodatabase user:{ name:'bruce', surname:'wayne', job:'batman', email:'onlyifdanger@batman.com', } so when user update info, I have to: query into database if user exist if exist get the values of the…
andrescabana86
  • 1,778
  • 8
  • 30
  • 56
3
votes
1 answer

efficiency of mongodb/mongoskin access by multiple modules approach?

I'm developing an express app that provides a REST api, it uses mongodb through mongoskin. I wanted a layer that splits routing from db acess. I have seen an example that creates a database bridge by creating a module file, an example…
ojon
  • 323
  • 1
  • 3
  • 7
3
votes
2 answers

Nodejs Mongo insert into subdocument - dynamic fieldname

{username:'me', companies:{"yourcompany":{...}} I want to insert a company into a user record (user collection), to make: {username:'me', companies:{ "yourcompany":{...}, "mycompany":{...} } But the name is dynamic.. var companyid =…
C B
  • 12,482
  • 5
  • 36
  • 48
3
votes
3 answers

How to display arbitrary, schemaless data in HTML with node.js / mongodb

I'm using mongodb to store application error logs as json documents. I want to be able to format the error logs as HTML rather than returning the plain json to the browser. The logs are properly schemaless - they could change at any time, so it's no…
hollsk
  • 3,124
  • 24
  • 34
2
votes
1 answer

TypeError: Cannot read property 'apply' of undefined at EventEmitter

I'm building a node js application with the DHTMLX Scheduler as one of the pages. However, whenver the page loads, the app crashes and I get the following error: TypeError: Cannot read property 'apply' of undefined at…
tyler
  • 125
  • 4
  • 14
2
votes
2 answers

Mongodb check for duplicate records for bulk insertions

My collection has records like: { "_id":"1", "field1":"foo","field2":"xyz", "field3":"something" ...} { "_id":"2", "field1":"bar","field2":"xyz", "field3":"something" ...} { "_id":"3", "field1":"foo","field2":"abc", "field3":"something" ...} {…
Kavya Mugali
  • 1,008
  • 2
  • 10
  • 17
2
votes
2 answers

How to deploy Node Js ,Express,and Mongo DB app to the Windows server 2012 R2

I have created an app using Express,Node.JS,and mongo db.I want to deploy it on my windows server 2012 R2.Please let me know the process.
user3868071
  • 23
  • 1
  • 9
2
votes
1 answer

Get specific field in array mongodb and return as array

I have the following document: { array: [ { type: 'error', data: 1 }, { type: 'error', data: 2 } ] } Is there anyway for my to get only the data field in each…
basickarl
  • 37,187
  • 64
  • 214
  • 335
2
votes
2 answers

Javascript Pushing elements inside a loop, doesn't affect the array outside the loop

I have an empty array that I want to push items onto, inside a loop. Once outside the loop, the array losses all information var result = []; users.find({}, {username: true, isOnline: true, uniq: true, _id: false}, function(err, cursor) { …
lazandrei19
  • 85
  • 1
  • 3
  • 7
2
votes
1 answer

Finding a MongoDB document through a word in a field description in each product with Mongoskin

This is an example of document that I have in my MongoDB: { "_id": ObjectId('5525039895884d66710d0fc3'), "prid": "63527", "data": { "sku": "HF22-81639", "name": "Product Test", "ean": "8763900872512", …
Despotars
  • 541
  • 1
  • 8
  • 23
1
2
3
11 12