Discussion:
[mongodb-user] Need to find the last value in a nested MONGODB document
m***@gmail.com
2018-12-04 10:43:54 UTC
Permalink
I have a nested document in a mongoDB named stages. There are numerous
objects within this document depending on how long a produce lasts
(sometimes 3, other times 4 +). Each of these objects contains 3 values:
name, TIME_COMPLETED and result. I want to created a shell command which
will allow to find the last TIME_COMPLETED value that is entered in .



db.completedTasks.find({"stages.TIME_COMPLETED":"2018-11-27T10:27:20.854Z"
})


This command allows me to accurately search for a specific TIME_COMPLETED
value, however I would like to find the last value in the stages document.(
Screenshot of mongo is attached).



Any help on this would be greatly appreciated.
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.com/manual/support/
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/fd9f0115-d35d-4327-a882-f9643cce1d38%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...