Linked Questions

42 votes
5 answers
67k views

Let's say I have a model called User. I have an array with object Ids. I want to get all User records that "intersect" with the array of Ids that I have. User.find({ records with IDS IN [3225, ...
TIMEX's user avatar
  • 274k
1 vote
2 answers
1k views

I am trying to search using node.js, ejs and mongoose. All the filter parameters are working perfectly but only categoryIds is not (stored as a collection of ObjectIDs in the mongodb document, ...
Mr.Singh's user avatar
  • 2,035
1 vote
1 answer
121 views

exp my collection users [ { _id: ObjectId('123456') username: 'test' }, { _id: ObjectId('654321') username: 'test2' }, { _id: ObjectId('...
Jubei Yagyu's user avatar
126 votes
11 answers
38k views

When using MongoDB's $in clause, does the order of the returned documents always correspond to the order of the array argument?
user2066880's user avatar
  • 5,044
7 votes
1 answer
14k views

In my MEAN-application (Angular2) I want to delete all referenced objects when deleting the object itself. I'm using Mongoose with the remove middleware. So my question.js file looks like this: var ...
Brudus's user avatar
  • 809
5 votes
2 answers
7k views

Select * from table_name where sport_type LIKE ('Cricket','Football'); I am trying to find the documents with sport_typeof Cricket and Football using find table.find({ sport_type : "Cricket" }) Can ...
Sai Phani Krishna Uppalapati's user avatar
13 votes
1 answer
9k views

I am trying to achieve the following: Select all the records that I own, where ownership is objects I have created OR objects a user I manage has created, where user management can be in a hierarchy ...
Toby Hede's user avatar
  • 37.3k
1 vote
2 answers
722 views

i have an array of object ids which i extracted from another instance. these object ids represent user ids in user model. i would like to use these object ids to get the user details How i got object ...
vithu shaji's user avatar
0 votes
1 answer
1k views

I'm wondering what the best approach would be to realize the following situation in Node.js and mongoose: I'm having a collection with users and a collection with groups. I want users to be able to ...
Koningh's user avatar
  • 628
4 votes
1 answer
374 views

Hello, I use Node.js to provide an API for storing data on a MongoDB database. I ran multiple tests on a read method, which takes ids and returns the corresponding documents. The point is that I ...
GnxR's user avatar
  • 849
0 votes
1 answer
592 views

How can i use the for loop with findOne from mongoose in node.js, maybe have other logic that i can do the same thing? data = { _id: '598b4e9abe74280be0b0cb1b' } { _id: '...
John's user avatar
  • 533
0 votes
0 answers
422 views

UPDATE - Solution: I was for looping instead should have used MongoDBs $in feature - details here I have the following Q.all block: Q.all([ getFirstBlock(), getSecondBlock(), ]) .then(function(...
userMod2's user avatar
  • 9,030
1 vote
0 answers
354 views

I'm working on a MERN project and I need your support. Which is the best way to get data with a REST call providing an array? I have an array of ID's and would like to take data using axios and the ...
anthares's user avatar
1 vote
1 answer
146 views

I have a search feature where filtered data is returned from my mongoDB based on a user's input for various filters. Here's an example, where records are returned that match for lastName values. This ...
Rey's user avatar
  • 1,433
0 votes
1 answer
129 views

So I am creating a basic todo app using express and mongodb at the backend, I have a task schema that looks like this : var taskSchema = mongoose.Schema({ task: String, time:Date, done:...
saurabh vyas's user avatar

15 30 50 per page