question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Document view] : Need to correctly handle ObjectID-like data when specified in nested fields

See original GitHub issue

Courtesy @Danlock for pointing this out. Pasting comment below:

Prior discussion here

Related to this issue, nested objectId are not set as object ids properly, in the case of:

{
  "_id": "5aa0150e1430142dda49b551",
  "createdAt": "2018-03-07T16:36:30.436Z",
  "data": {
    "Quasi": "8590406b-67fa-4e08-819d-2860f5fdca79"
  },
  "name": "g6d-car",
  "sensors": [
    {
      "_id": "5adf3b43194dd500010542ea",
      "createdAt": "2018-04-24T14:12:19.693Z",
      "type": "camera"
    }
  ],
  "type": "car",
  "updatedAt": "2018-04-24T14:12:19.693Z"
}

If I make any changes the inner sensor ids will be overwritten with “5adf3b43194dd500010542ea” instead of ObjectId(“5adf3b43194dd500010542ea”).

I can make another issue if you want, but this seems relevant.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
PrashanthCorpcommented, Apr 27, 2018

I have a basic test for arrays under the relatedTo property.

From my understanding, UUID is part of the binary data type, of sub-type 3 or 4 here and in the spec - under non-terminals.

For testing that the constructed UUID remains consistent, I used the mongo shell to create a UUID(with a 32 digit hex seed), insert that in a document, and verify that the uuid property (24 chars, different from the 32 digit seed) is consistent across out extension and the shell. Run a few updates on the doc in the extension, and the uuid remains unchanged. For basis, I used the seed from the mongo docs. The generated UUID matches the example through the updates.

Hope this helps!

0reactions
Danlockcommented, Jun 5, 2018

The fix has been merged. I’ve used it and nothing appears to be on fire yet.

One thing to keep in mind is that it updates a document by overwriting it, so you have to be careful not to to overwrite other changes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query on Embedded/Nested Documents — MongoDB Manual
Query/select by embedded documents/nested fields/subdocuments. ... Use the Select your language drop-down menu in the upper-right to set the language of the ...
Read more >
Spring Data MongoDB - Reference Documentation
The Spring Data MongoDB project applies core Spring concepts to the development of solutions that use the MongoDB document style data store.
Read more >
Update fields in nested objects in firestore documents?
I have a data structure like:.
Read more >
Nested field type | Elasticsearch Guide [8.5] | Elastic
Field data types ... Nested documents and queries are typically expensive, ... If you need to index arrays of objects and to maintain...
Read more >
Querying nested and repeated fields in legacy SQL | BigQuery
The preferred query syntax for BigQuery is Google Standard SQL. For information on handling nested and repeated data in Google Standard SQL, see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found