Questions tagged [subdocument]

Concept in document-oriented databases, where a field in document is a document in itself.

Concept in document-oriented databases, where a field in document is a document in itself.

Example document as JSON, where address is a subdocument:

{
    name: "Snake",
    address: {
       street: "742 Evergreen Terrace",
       city: "Springfield"
    }
}
288 questions
0
votes
1 answer

how to retrive all the document in sub document array and if there is any duplicates of field how to retrive the latest one?

i am having db structure like this below. { "_id": ObjectId("53770b9de4b0ba6f4c976a27"), "source": [{ "value": 5127, "createdAt": ISODate("2014-05-7T07:11:00Z"), "generated": ISODate("2014-05-17T07:23:00Z"), }, { …
Soorya Prakash
  • 921
  • 3
  • 9
  • 29
0
votes
1 answer

MongoDB: how to access numerical keys in the map

I have the below document in my collection { "_id" : ObjectId("53732dc386d78e446c73fbb3"), "elig" : 18, "tags" : { "6" : "49.6", "9" : "657" }, "book" : { "type" : "100", "id" : "59598699" …
0
votes
1 answer

et Return the Whole Subdocument Arrary from MongoDB

I need to get all of the subdocuments array from the Courses Class where the User.UserId = whatever and Courses.Status=active Public Class User Public Property UserId As String 'this is unique so i would like to index this, unless you think…
0
votes
1 answer

Mongodb: find subdocuments whose fields are in non-canonical order

As I switch to subdoc equality testing, I want to ensure all of my documents' subdocs field orders are in the canonical ordering which I will be testing. I cannot figure out a good query for checking this. That is, given these records: {'_id': ..,…
DHM
  • 155
  • 1
  • 1
  • 8
0
votes
1 answer

mongodb subdocument causes growth?

Say that I have a document looking like: { "_id" : "1234", "foo" : { "bar1" : 2 } } Does adding a "bar2" field in "foo" cause document growth, which means that it has to be moved on the disk, etc? Thanks
LaurentH
  • 301
  • 2
  • 10
0
votes
1 answer

Getting subdocument element's count per index inside an array and updating the subdocument key - subdocument in array(IN MONGODB)

How to get subdocument element's count inside an array and how to update the subdocument's key in MongoDB For eg, following is the whole doc stored in mongodb: { "CompanyCode" : "SNBN", "EventCode" : "ET00008352", "EventName" : "Sunburn…
0
votes
1 answer

MongodDB retrieve a subdocument by the property name

My document looks like: { "entity_id" : 2, "features" : [ { "10" : "name" }, { "20" : "description" }, ... , { "90" : "availability" } ] } I would like to, knowing 2 things: the value of "entity_id" (2), and the value of…
Alex
  • 210
  • 2
  • 13
0
votes
2 answers

Does MongoDB duplicate subdocument with identical data?

I'm completely new to MongoDB and looking at moving my base persistence code (for many projects) over to it using JDO as an agnostic layer. So I'm asking this question from the perspective of a java developer who likes to the work with beans as the…
0
votes
1 answer

Is it possible to make a "not modify " constrain on MongoDb subdocuments at creation?

I'd like to make a specific subdocument value from a MondoDb document fixed, so it can not be possible to modify it at a next update, or any other MongoDb operations that can modify documents. For example, if a document like the one bellow is…
Roxana
  • 33
  • 1
  • 1
  • 6
0
votes
1 answer

replica set lag caused by $push of subdocuments

I have a document that logs a user journey within my site. Mouse movements are stored as a subdocument of this document. I log mouse movements then periodically use $push to append to the subdocument array. From my initial readings on Mongo this…
John Greenall
  • 1,670
  • 11
  • 17
0
votes
1 answer

access subdocument in mongoDB

I have a collections users in mongoDB with a widgets document for every user like this : Widgets = [{ type: 'container', size: 12, offset: 0, id: 'root', children: [ { type: 'widgetSearch', title: 'Recherche', offset: 0, …
Ricklemer
  • 201
  • 1
  • 2
  • 10
-1
votes
3 answers

How to Fix 'Each child should have a unique key prop?

Hi everyone I would like to display for each element all of its sub-documents.
    {designModdulles.map((designModdulle)=>
  • {designModdulle.epreuves.nature_epreuve}
  • ) }
``` I…
Mouni19
  • 1
  • 1
-1
votes
1 answer

Mongo $projection, can you flat a sub-document array?

I was wondering if there is a way to "flatten" though projection a nested sub-document array so I could use it to sum its entries based on type. My document looks like this: { "order_id":12345, "date":8/17/2019, "payment":{ …
Or A
  • 1,789
  • 5
  • 29
  • 55
-1
votes
2 answers

Selecting Specific Array Element

I am working with Couchbase v4.5 and the .NET SDK version 2.3.8. I am in the midst of migrating a view to a N1QL query. The Javascirpt available to the view provided me the flexibility of sorting array members of the document, and subsequently…
Kenneth K.
  • 2,987
  • 1
  • 23
  • 30
-1
votes
1 answer

Search in subdocument

Hello I want to get all the contacts with syncFlag true in contact object. I tried this solution but only returns only one sub document and I also tried this solution it returns all the documents either they are matched or not How to find document…
1 2 3
19
20