Comments (5)
Thank you for your bug report.
In LokiDB the nested property support has been changed and extended to support binary indices and full-text search indicies by adding getter/setter methods to your documents.
To get your example work, you have to add this to the collection constructor:
nestedProperties: ["key.subkey"]
or to make an alias name:
nestedProperties: [{name: "MyNewSubKey", path: ["key", "subkey"]}]
from lokidb.
Ah, I missed the nested properties option and that does solve the initial question. One additional question in regard to this does/can nestedProperties work for querying object keys nested in an array? Data would be something like this:
{
_id: _.uniqueId(),
arrayObjects: [
{
_id: _.uniqueId(),
key: `value ${ i }`
}
]
}
and the query would be something like { 'arrayObjects.key': 'value 1' }
Thanks!
Chris
from lokidb.
from lokidb.
That worked perfectly once I figured out how $contains works :-)
Out of curiosity what is the reasoning behind $contains instead of just using the dot notation to find the value? I only ask because finding the value with just dot notation would be more consistent with the mongo api.
Thanks for all of the help!!
from lokidb.
I am glad I could help.
Hmm, that is sad, that it differs from the mongo API...
The problem is, that the dot notation is now resolved while inserting a new document to the collection by adding getter and setter to it and not like LokiJS and MongoDB while performing a query:
The advances are:
- Only on place you have to handle dot notations
- The query don`t have to be parsed for dot notations
- Support for nested binary indices and full-text search (but not for ones inside arrays)
- Nested property names don`t have to be dots
The disadvances are:
- If the nested property is inside an array, we return all nested properties as array
Maybe I can fix this disadvances some how...
from lokidb.
Related Issues (20)
- Project status? Still maintained? HOT 8
- Implement redis like append only storage
- _maxId should be removed, $loki should be able recycled.
- LokiFsStructuredAdapter Equivalent HOT 2
- Examples needed HOT 3
- Fuzzy search not behaving as expected in all cases? HOT 3
- Error thrown when DB does not exist and autoload is set to true HOT 1
- FTS fails (any everything crashes with it) if value of the field is not present HOT 1
- [bug] Searching on indexed collection causes error HOT 5
- "this._changes is undefined" when adding records to auto-loaded db & collection HOT 9
- collection.removeCollection does not get autosaved into persisted DB HOT 1
- Async operations? HOT 1
- LokiDb expects data to not have a meta field
- fulltextsearch docstore does not clear when clear is called on a preloaded collection HOT 1
- What's the best index for $eq only, or perhaps JOINing collections? HOT 1
- How is LokiDB the official successor of LokiJS? HOT 12
- When will LokiDB be updated if it all there has been no recent activities. HOT 1
- Cannot read property 'char_filter' of null
- Rename meta field
- Batch larger serialisations HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lokidb.