Comments (7)
I confirmed that for un-nested properties, the
excludeFromIndexes: true
property parameter allows long strings to be saved. How do we pass that goodness to nested properties? Is there such a thing as subdocs/childschema here ala mongoose.js?
var childSchema = new Schema({ name: 'string' });
var parentSchema = new Schema({
// Array of subdocuments
children: [childSchema],
// Single nested subdocuments. Caveat: single nested subdocs only work
// in mongoose >= 4.2.0
child: childSchema
});
from gstore-node.
Hello,
Yes the long string cannot be indexes in Google Datastore that's why you need to set 'excludeFromIndexes' to true.
For what I remember embeded entities are not indexed by default. Have you tried to set 'excludeFromIndexes' on the Schema to those properties?
thanks
from gstore-node.
from gstore-node.
I tried this demonstrating that nested properties are subject to the 1500 character limit as 'string' properties. If these can be classified as 'text' properties then the limit would not apply perhaps? Not sure:
./server/apis/test.model.js :
const gstore = require('./datastore.js');
const Schema = gstore.Schema;
const testArray = new Schema({
texts: {type: 'object', excludeFromIndexes: true}
let Model = gstore.model('test', testArray);
module.exports = Model
});
> var model = require('./server/apis/test.model.js')
datastore.js
shioh.productArray.model.js
undefined
> var obj = {a:'hello',b:{c:'hello'},d:{e:{f:(function(){var i = ''; for(let j=0;j<2000;j++){i=i.concat('a') }; return i } )()}}}
undefined
> obj
{ a: 'hello',
b: { c: 'hello' },
d: { e: { f: 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' } } }
> ent = new model({texts:obj})
ModelInstance {
className: 'Entity',
schema:
Schema {
instanceOfSchema: true,
methods: {},
statics: {},
virtuals: {},
shortcutQueries: {},
paths: { texts: [Object] },
callQueue: { model: {}, entity: {} },
options: { validateBeforeSave: true, queries: [Object] },
__meta: {} },
excludeFromIndexes: [ 'texts' ],
entityKey: Key { namespace: undefined, kind: 'test', path: [Getter] },
entityData: { texts: { a: 'hello', b: [Object], d: [Object] } },
pre: [Function: pre],
post: [Function: post],
hook: [Function: hook],
__setupHooks: [Function: __setupHooks] }
> ent.save()
Promise { <pending> }
> (node:21492) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: The value of property "f" is longer than 1500 bytes.
from gstore-node.
This appears to be an ongoing concern. It is not clear that nested properties are excluded from indexing on the basis of exclusion of the parent property.
googleapis/google-cloud-node#1916
from gstore-node.
Sorry for the late answer. It seems that it is a "hot" topic from the issue you pass :) I didn't bump into this problem so I was not aware of it. As embedded entities are not indexed I thought that their properties were not indexed either and thus the 1500 length limit did not exist.
As gstore node is just a wrapper on top of google-cloud, I will follow the issue and according to the fix/solution they come with I will update the lib.
thanks for reporting! 👍
from gstore-node.
Hello,
I realised yesterday that google cloud made an update to the API for embedded entities. I just published a new version of gstore node (v1.5.0) that should allow the exclusion of embedded entities properties in the indexes.
You can see the update in the docs
https://sebelga.gitbooks.io/gstore-node/content/schema/other-paremeters.html
from gstore-node.
Related Issues (20)
- query filter on nested property value. HOT 5
- tsc error: Could not find a declaration file for module 'nsql-cache' HOT 3
- could not get data filter by entity key
- Support for @google-cloud/datastore version 5 HOT 2
- Support for custom validators (AJV)
- bulk insert? HOT 2
- Cannot read property 'Symbol(KEY)' when body is null or undefined HOT 1
- Typescript Compile Error HOT 2
- Support for HABTM
- Could not find gstore instance with id "${id}" HOT 2
- How to validate a value agains another property? HOT 1
- Datastore Key type error when using cache HOT 7
- Update method doesn't clear cache HOT 6
- Add Transaction support to `findOne` option HOT 1
- Support filtering for a missing optional property. HOT 1
- New query operators HOT 1
- @google-cloud/datastore version 7 support HOT 1
- could not get data filter by entity key HOT 1
- Migrate Travis CI builds to Circle CI
- Gstore node 7.2.8 TypeError: OptionalDataloader is not a constructor
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 gstore-node.