Questions tagged [mongojs]

MongoJS is a Node.js package to access MongoDB.

References:

306 questions
1
vote
2 answers

How to load mongojs module

I've some problem using mongojs. When I try to call a function (that is defined in a javascript file) from an html page I've got this error: Uncaught Error: Module name "mongojs" has not been loaded yet for context: _. Use require([]) In the file…
1
vote
1 answer

NodeJS does not respond to CURL Request

Im using NodeJS to perform som Queries to a MongoDB. I've set up the routing so when http://127.0.0.1:8888/GetAllCities is called, a function name GetAllCities will run on the server and perform a MongoDB query and return the result. This…
JOSEFtw
  • 9,781
  • 9
  • 49
  • 67
1
vote
2 answers

Mongojs fetching data from two collections and merging the result

I am a mongodb newbie and would greatly appreciate help on this problem described below. I have two collections "users" and "bags". The user collections scheme has {username, firstname, lastname} and the bag collection schema has {username,…
Ami Titash
  • 15
  • 2
1
vote
1 answer

How to enable Mongojs Safe Option?

Consider the following nodejs code: db = require('mongojs')('database', ['users, sessions']); db.users.insert( { 'email': email, 'password': password, 'firstname': firstname, 'lastname': lastname }, function(err) { // will there ever be…
SChang
  • 1,669
  • 2
  • 13
  • 13
1
vote
1 answer

MongoJS not returning data when searching with regular expressions

Node.js, mongojs, mongodb. I am searching through a list of skills using regular expressions. Here is my server code: var nconf = require('nconf'); var db = require('mongojs').connect(nconf.get('mongolab:connection'), ['skills',…
Alex Polkhovsky
  • 3,340
  • 5
  • 29
  • 37
1
vote
1 answer

How to select value from MongoJS query output

I have MongoJS query call: db.users.find({username:"eleeist"},function(err, docs) { console.log(docs); }); The docs variable looks like this in console output: [ { _id: 4fee05662b17f88abbeb60b6, username: 'eleeist', password: 'test' }…
Eleeist
  • 6,891
  • 10
  • 50
  • 77
1
vote
1 answer

mongoJS parsing JSON output

I'm playing with nodeJS and mongoJS. I've successfully queried the DB and returned a set of data: var databaseUrl = "redirect"; // "username:password@example.com/mydb" var collections = ["things", "reports"] var db =…
Ric_Harvey
  • 63
  • 1
  • 13
0
votes
1 answer

Unable to access MongoDB server running on AWS EC2 machine

I am running MongoDB server v6.0.4 on AWS EC2 Linux machine, which is publicly accessible. Using MongoDB: 6.0.4 Using Mongosh: 1.8.0 /etc/mongod.conf # network interfaces net: port: 27017 ipv6: true bindIp: ::,0.0.0.0 # Tried with…
Lovababu Padala
  • 2,415
  • 2
  • 20
  • 28
0
votes
0 answers

how to fix cannot read properties of undefined (reading 'push') in mongodb with djs

const { Client, CommandInteraction, EmbedBuilder, Permissions, ApplicationCommandType } = require("discord.js"); const { Formatters } = require('discord.js'); const blacklistedWords = require("../../Collection/index.js"); const Schema =…
0
votes
1 answer

Express not awaiting MongoJS Function

I've set up a function for my Express JS endpoint to 'await' to get a result from a Mongo DB using Mongo JS. Function:- async function getIntroducer(company){ const intro = await dbIntro.collection('introducers').findOne({company: company}, …
0
votes
0 answers

Cannot read collection from MongoDB

So, I'm trying to connect a mongo database and it's already connected. But my issue is that I can't read collection from mongo in another file, it says: db.collection is not a function. So this is my db.js file: const { MongoClient } =…
Jan Tuđan
  • 233
  • 3
  • 17
0
votes
1 answer

No result from MongoDB / MongoJS query

I'm trying to query my DB for users, but nothing happens when I try. Here is my code to query the DB: console.log("before db.user"); db.user.find({steamid: userSteamId}, function(err, user){ if(err || !user){ console.log("No account found,…
Kossi
  • 77
  • 2
  • 10
0
votes
1 answer

MongoJS Not Deleting By ID

async deleteRecipeById(recipeId){ try{ const client = new MongoClient(this.uriString); await client.connect(); const db = client.db(this.databaseString); const recipeCollection =…
jakegergen
  • 135
  • 1
  • 1
  • 10
0
votes
0 answers

Promise Resolved but Does Not Trigger .then() but Only on Debian server as a Module

I've been having trouble with handling data from MongoDB using MongoJS where I have a promise that refuses to resolve. I am honestly confused why this does not work. It works completely fine on my local machine but once I move it to my server it…
10Nates
  • 102
  • 10
0
votes
2 answers

How can I combine the results of 3 queries in MongoDB?

I made the following filter in hopes that I would be combining the results from all 3 $and arrays but it is only matching one of those blocks. How can I combine the results of what would be returned from each $and array if conditions are met.…
mastercool
  • 463
  • 12
  • 35