Suppose I follow users 4, 7, 10, and 20. How can I query that in Mongo?
db.all_posts.find(users = 4, 7, 10, 20).sort( by date )
I don’t know the right syntax. Is this scalable?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use the
$inoperator to match against multiple values:As you can see, the
find(),sort()and most other methods in MongoDB take in objects as parameters. These objects are called query expression objects.The question Making a Twitter-like timeline with MongoDB should answers your question about scalability, as it discusses the same data model as yours.