5 ms·
Just a quick note: There is a feature planned called "virtual collections" for querying the embedded collection as if it were a standalone collection. That way
by albertoperdomo 15y ago
Just a quick note: There is a feature planned called "virtual collections" for querying the embedded collection as if it were a standalone collection.
That way you could easily do
db.posts.$comments.find({"name": username})
to retrieve all posts by a user, or
db.posts.$comments.find().sort({date:-1}).limit(10)
to retrieve the latest 10 comments on the blog.
Link to the feature in MongoDB's issue tracker: https://jira.mongodb.org/browse/SERVER-142 https://jira.mongodb.org/browse/SERVER-142