adding multible objects parts to bson array

27 views
Skip to first unread message

javantamt

unread,
Apr 9, 2016, 3:31:50 PM4/9/16
to mongodb-user
Hey there!
there is a JSON file in a BSON Object looking like the following.
I'm going to add in the marked areas the same attribut. I'm having problems in my loops to get the number of elements from a array. so I can't navigate in it. Only possible way I see is to iterate through every single element of the array and check if the returned value is 0x00 or valid.
Is there a possebilety to get the number of elements in the array?

Any help would be awesome!

thx!

{
   
"_id" : ObjectId("5705918cb6a7d12aea0525f1"),
//add: "status" : 0
   
"targets" : {
       
"fast" : [
           
{
               
"size" : "poster",
               
"format" : "jpg",
               
"count" : 5
       
//add: "status" : 0
           
},
           
{
               
"size" : "thumb",
               
"format" : "jpg"
       
//add: "status" : 0
           
}
           
// more fields of the array could follow here...          
       
],
       
"slow" : [
           
{
               
"size" : "sd",
               
"format" : "mp4"
       
//add: "status" : 0
           
},
           
{
               
"size" : "sd",
               
"format" : "webm"
       
//add: "status" : 0
           
}
           
// more fields of the array could follow here...              
       
]
}}  


Andrew Morrow

unread,
Apr 15, 2016, 1:29:22 PM4/15/16
to mongod...@googlegroups.com

Hi -

What driver or API are you trying to use to accomplish this?

Thanks
Andrew


--
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.org/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 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/63de780c-6004-4879-a517-75839848cbe5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages