Skip to content
Advertisement

Tag: mongodb

SyntaxError: Unexpected token

I am using MongoDB + Node.js to create an app, but I am receiving an error for this code: company.js api.js Error friends.name: req.body.friendName, SyntaxError: Unexpected token . I also tried with friend[‘name’] but the result was the same: SyntaxError: Unexpected token [ Please tell me where is my mistake Answer Try: or: depend on what you’re after.

Mongoose JS findOne always returns null

I’ve been fighting with trying to get Mongoose to return data from my local MongoDB instance; I can run the same command in the MongoDB shell and I get results back. I have found a post on stackoverflow that talks about the exact problem I’m having here; I’ve followed the answers on this post but I still can’t seem to

Mongoose auto increment

According to this mongodb article it is possible to auto increment a field and I would like the use the counters collection way. The problem with that example is that I don’t have thousands of people typing the data in the database using the mongo console. Instead I am trying to use mongoose. So my schema looks something like this:

Mongoose find/update subdocument

I have the following schemas for the document Folder: So, for each Page I can have many permissions. In my CMS there’s a panel where I list all the folders and their permissions. The admin can edit a single permission and save it. I could easily save the whole Folder document with its permissions array, where only one permission was

Advertisement