Tagged Questions
Mongoose is a MongoDB object modeling tool, or ODM (Object Document Mapper), written in JavaScript and designed to work in an asynchronous environment.
1
vote
0answers
9 views
how to update a user after a certain time in node js and mongoose
How to automatically deduct credits from a user's available credits according to his active services renewal date. ?
Hello, friends, I need some help from you.
Let me describe what is the current ...
0
votes
0answers
10 views
passport-local-mongoose: createStrategy is not a function / authenticate is not a function
I'm building on top of this starter project and trying to add user login with passport-local-mongoose.
Depending on which of the two ways I try to use the strategy I'm getting either this error:
[1] ...
0
votes
1answer
24 views
Unable to login using passport - Nodejs
I am following one of the Udemy tutorial and I am stuck in the last bit of login process. I am able to register new user but unable to login. I enter email address and password. On pressing submit ...
0
votes
1answer
26 views
How can i design Schema for below product using mongoose?
category : shirts
name : aaaa shirts
type :
slimline
superslim
fittedbody
fabric :
twill , denim , dobby
...
-1
votes
1answer
18 views
how to make a block completely synchronous which consists of mongoose query?
for(var i = 0 ; i < objects.length ; i++){
if(type == "user")
{ // normal mathematical calculations
// result.push(objects[i])
}
else if( type == "group"){
// Here i need a query "group" ...
1
vote
1answer
16 views
creating a schema, one of its fields include an objectId that refers to the other schema objectId, and a string
Here is the code. The following and follower are not able to work. In other words, I can't push an object like {"user1", objectId1} to these two arrays.
Is allowed to have a field that includes both ...
0
votes
0answers
5 views
How do I make mongoose fail a save() if the document has been modified in the meantime?
I want to take advantage of all the validation and simplicity of using Model#save(). But I want my updates to models to be atomic. Is there a simple way to ask Mongoose to make the Model#save() call ...
0
votes
1answer
15 views
Increment or create multiple nested values inside of an array in mongoose
I'm trying to increment a value inside of an array if it exists, and if it doesn't add it. Currently My schema is:
var skills = ['Attack', 'Strength', 'Defence', 'Ranged', 'Prayer', 'Magic',
'...
0
votes
0answers
19 views
Using $sum to add up all the values of a two objects with arrays in Mongo shell?
I'm trying to get the sum of the second items in each array in each object. For ex:
items:
- 0 {
"key": "Reservations",
- "values":
[date, amount],
[date, amount],
[date, ...
1
vote
1answer
11 views
Mongoose .populate() is not populating due to MissingSchemaError
I am trying to populate a users array with user info that's using an Object ID reference in Mongoose.
Here is my user.js model:
var mongoose = require('mongoose');
var User = mongoose.Schema({
...
0
votes
1answer
22 views
solved - MongoDB index search works in console, but not from browser
All of this was working yesterday so I'm really not sure whats wrong. I'v searched on SO and been through the docs and steps a number of times but I havnt got it to work. Any help much appreciated ...
0
votes
0answers
16 views
I need to use a function to check if a uid already exists in the database before the user is created
I'm building an application, and I have everything set up and working properly. I did some modifications, using rand-token, to have shorter ID's for user profiles, comments, and posts.
I am able to ...
0
votes
0answers
7 views
Mongoose does not save updated date value in a nested array … what is the correct path for .markModified?
I'm having problems getting Mongoose to save an updated Date value on an element of a nested array by using the schema's save() method. I'm aware that Mongoose does not automatically recognize changes ...
0
votes
1answer
17 views
Mongodb ignoring $push when updating.
I am tying to push a date/text to my user tables userLog
usersTable.update (
{ _id: userID },
{ $set:
{
activityDate : Math.round(new Date().getTime()/1000),
...
0
votes
0answers
5 views
Error MongoDB in C9
I have problem with Mongo. Yesterday I set up the server, and worked. Then I closed C9 withoud pressing ctrl + C and now it doens't work. I tried to repair it and removing the "lock", but nothing.
I ...