Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
1
vote
0 answers

How to handle authentication over a node rest server with users stored in mongo without having a connection per user logged?

I'm trying to find the best way to authenticate users against my server and how to handle the connection pool. Since I'm not sure if it is better to create a connection per new connection so as to authenticate a new user or to have connections…
1
vote
2 answers

Is it possible and ok to use mongoose and mongo js both in the same app.?

I would like to use mongo js and mongoose in the same app.I require mongo js as i don't want write schema for a specific functionality of the app as it includes nested and complex data.I tried mongoose but that just makes it more difficult.With…
Mohammed Gadiwala
  • 1,923
  • 2
  • 18
  • 26
1
vote
2 answers

findOne() doesn't work - is something wrong with my syntax?

Db creation: var mongojs = require('mongojs'); var db = mongojs('rodrigo-contatos', ['rodrigo-contatos']); i'm trying to do a search in database with this code, using findOne from mongojs, that is the code: app.get('/detalhesContato/:id',…
michelpm1
  • 177
  • 1
  • 1
  • 12
1
vote
1 answer

NodeJS MongoDB Connection string problems

I'm new to using MongoDB and would appreciate some help in replicating the following command in my NodeJS application. mongo --host dds-xxxx.mongodb.rds.aliyuncs.com:3717 -u root -p password --authenticationDatabase admin I need to be able to…
Nodal
  • 353
  • 2
  • 14
1
vote
1 answer

Set write concern for mongojs collection

I would like to set the write concern for an entire collection using the mongojs library. This is what I think the code might look like var mongojs = require('mongojs'); var db = mongojs('testdb'); var test = db.collection('test', {writeConcern:…
Loourr
  • 4,995
  • 10
  • 44
  • 68
1
vote
1 answer

Node.js & MongoDB Can't canonicalize query

I have a NodeJS script that was working on a server for 6 months, this week I've setup a new server and have installed all updated versions of softwares, including mongojs, nodejs and mongodb, and somehow my code doesn't work anymore. The part of…
1
vote
1 answer

Node js, %1 is not a valid Win32 application, js-bson: failed to load c++ bson extension, windows

I did npm install and node app.js. Then it shows that [Error: %1 is not a valid Win32 application; C:...\mongojs.....\bson.node] js-bson: Failed to load c++ bson extension, using pure JS version. I am not sure if this is only one error or two…
Irene Liu
  • 17
  • 1
  • 3
1
vote
2 answers

Best way to move object from one collection to other in NodeJs

How to move object from one collection to other ? What is the easiest and safest way to do it? I was trying with that: app.post('/doneList/:id',function(req, res){ var id = mongojs.ObjectId(req.params.id); var oneTodo; …
1
vote
0 answers

How to connect to a single url among multiple urls using mongojs module in node

I am interested to connect to a mongodb database hosted on mms using mongojs module. If one database instance fails, mms will make one of the other database instances to become primary.But is IP address changes. How the server application where…
hello world
  • 660
  • 2
  • 6
  • 25
1
vote
1 answer

How to filter out the same keys that you $slice in mongodb

I have a collection as this: [ {_id: "1234", myId: 1, a: [1,2,3], b: [23,3,2], c: [3,234,4], ...}, {_id: "5678", myId: 2, a: [21,32,3], b: [32,123,4], c: [32,32,12], ...}, {_id: "3242", myId: 3, a: [21,23,2], b: [12,2,32], c: [12,213,1],…
maazadeeb
  • 5,922
  • 2
  • 27
  • 40
1
vote
1 answer

How to multi-sort MongoDB entry with dynamic keys, on two suboptions?

I'm trying to sort this in MongoDB with mongojs on a find(): { "songs": { "bNppHOYIgRE": { "id": "bNppHOYIgRE", "title": "Kygo - ID (Ultra Music Festival Anthem)", "votes": 1, "added":…
1
vote
1 answer

Find document by timestamp using mongojs

I want to find document in a mongodb table using node js. I'm currently working with mongojs plugin. Here's what I have problem with: I connect into DB. I get the current timestamp Every 10 seconds I want to print all elements added within this 10…
Lelas
  • 73
  • 1
  • 7
1
vote
1 answer

Is it possible to create connections to multiple remote MongoDB databases?

Using mongojs or any other nodejs library, is it possible to create connections to multiple remote MongoDB databases (not replicated dbs) ? What I need to do is fetch some data in a collection in remote database A, process it then update some other…
Running Turtle
  • 12,360
  • 20
  • 55
  • 73
1
vote
0 answers

I'm using mongojs with nodejs on heroku. I am getting an error such as "failed to connect to [127.0.0.1:27017]"

I'm using mongojs with nodejs on heroku. After deploying the app and using POST from Curl, i am getting an error such as "failed to connect to [127.0.0.1:27017]". Would be great if someone can help me out... var restify = require("restify"); var…
Mithilesh D
  • 31
  • 1
  • 1
  • 3
1
vote
2 answers

How to query for objects between date ranges

I have documents in mongodb collection that looks like below: "listingReservation" : { "reservationFromDate" : new Date("14.1.2015 00:00:00"), "reservationToDate" : new Date("17.1.2015 00:00:00"), "reservationCreatedBy" :…
Chidu Murthy
  • 688
  • 3
  • 10
  • 26