--
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 a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/X9UltGPVpnw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@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/e8108724-87ff-4ebf-a56e-47ea3868687b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
MongoDB Enterprise > db.articles.find({})
{ "_id" : ObjectId("5ba13b23a8473592bc32933c"), "author" : "dave", "score" : 80, "views" : 100 }
{ "_id" : ObjectId("5ba13b23a8473592bc32933d"), "author" : "dave", "score" : 85, "views" : 521 }
{
"_id" : 2,
"quizzes" : [ ],
"attendees" : [
ObjectId("5ba13b23a8473592bc32933c"),
ObjectId("5ba13b23a8473592bc32933d"),
ObjectId("5ba13b23a8473592bc32933e"),
ObjectId("5ba13b23a8473592bc32933f"),
ObjectId("5ba13b23a8473592bc329340"),
ObjectId("5ba13b23a8473592bc329341"),
ObjectId("5ba13b23a8473592bc329342")
]
}
$ cat test_function2.js
use test1
var myIds = new Array()
db.articles.find().forEach(
function(e) {
myIds.push(e._id.str)
var t = e._id.str
print("user : " + t + " author : " + e.author )
db.mapinput.update( { "_id" : 2 }, { "$addToSet" : { "attendees" : ObjectId(t) } } )
}
)
myIds
Hi Robert, Thank you so very very much!!! Just seeing that it worked for you helped! I was able to insert a object id into the array too. Big thanks!!! M.