Questions tagged [embedded-documents]

95 questions
1
vote
1 answer

Is there a Java annotation to generate parameter documentation?

Projects like hadoop have a ton of parameters, but all that documentation is manually generated from xml, rather than coming from the code. Is there a way of doing something with an annotation that can generate this documentation? public static…
Alun
  • 541
  • 6
  • 16
1
vote
1 answer

Get empty array on a bson doc from mongoid for newly initialized parent object

Trying to get my initial object to have an empty array the represents an embedded has many documents that currently has no documents embedded. I can get the relationship in the json string when it has a doc embedded or after I delete all embedded…
1
vote
0 answers

Locking text fields in embedded document

I have been tasked with updating a spreadsheet that produces a report by replacing text in a template. Previously, the worksheet referenced an outside/separate file-- my job is to get it working in an embedded document. I currently have text form…
Sooji
  • 169
  • 3
  • 18
1
vote
1 answer

mongoid get embedded documents parent by childrens id

I have two models Class FirstModel embeds_one :second_model, class_name: 'V1::SecondModel' Class SecondModel embedded_in :first_model, class_name 'V1::FirstModel' I have some records of first model and I can get second model records from first…
Subash
  • 3,128
  • 6
  • 30
  • 44
1
vote
0 answers

MongoEngine embedded document. Add attribute key error

I've made a modification to my embedded document, added a date. Do I really have to make same changes also to database or can it be done via mongoengine? Sample: class History(EmbeddedDocument): historyType = StringField() historyId =…
1
vote
1 answer

How do I properly use mongoengine embedded document in Django Rest Framework

I am trying to make a comment system that uses MongoDB as the backend and Django Rest Framework and Mongoengine as the front end. The comment system would save Comments in the database and every comment will have one and only one Author. The…
0
votes
2 answers

MongoDB How to add a field to ALL embedded documents in an array

If I have some documents inside a collection. In this format: {posts: [{"name": "post1"},..., {"name": "postN"}]} What is the equivalent of this function: db.my_collection.update({}, { $set: {"posts.0.lastMod": new Date()}}, false, true) But to…
lpares12
  • 3,504
  • 4
  • 24
  • 45
0
votes
1 answer

How to bring back only nested documents fitting filter

I have created a mongodb collection where the schema is as follows. {user_id, listings: , ...} In the listing documents I have a field named status which has two values publish and draft. In mongo shell I am trying to bring back…
peter
  • 15
  • 3
0
votes
0 answers

Cypress.io cannot find any element, body or class

I've started testing a .jsp page which includes iframes. After visiting the page it cannot find a single element, img, class etc etc. Even using the playground selector it doesn't seem to recognize any link or elements. I'm unsure if I need to…
chad_jw
  • 21
  • 3
0
votes
1 answer

How to Update many elements in mongoose array which has embedded documents

I have this mongoose model resourceId: { type: String, }, resourceName: { type: String, }, dateAndValue: [ { date: { type: Date }, value: { type: Number }, }, ], project: { type:…
0
votes
1 answer

"$pull" doesn't delete the embedded documents of mongoose array

My mongo schema is as below: resourceId: { type: String, }, resourceName: { type: String, }, dateAndValue: [ { date: { type: Date }, value: { type: Number }, }, ], Once…
0
votes
1 answer

setState of address array inside data object

I am new to React, and I am currently working on an app using the MERN stack and was looking for a bit of advice. I have React User component that calls & renders a user object with embedded documents from mongodb. When I return the data from the…
McGooks
  • 31
  • 5
0
votes
1 answer

how to retrieve the value from a submitted html form and store it inside the nested document in mongoose schema

Mongoose Schema: const addressSchema = new Schema({ street: { type: String, trim: true }, state: { type: String, trim: true , match: [/^[a-zA-Z]{2,}/, 'Please Enter State in a Correct Format']}, zip: {type: Number,…
0
votes
1 answer

MongoDB multikey index on array of embedded document - sort/range comparisons and min/maxkey

Simplified example and question In effort to be as simple as possible, I'll just jump into an example: Collection foo with multikey index {searchTags: 1}: {_id: 1, searchTags: [{bar: "BAR"}]} {_id: 2, searchTags: [{baz: "BAZ"}]} I'm trying to get…
crunk1
  • 2,560
  • 1
  • 26
  • 32
0
votes
2 answers

Mongodb: Create embedded document - get Id

I'm trying to implement a simple CRUD Create for an embedded document. The URL is like this [POST] /restaurants/:id/subsidiaries The query looks like this: const restaurant = await Restaurant.findByIdAndUpdate(req.params.id, { $push: { …
pa1nd
  • 392
  • 3
  • 16