Giter Site home page Giter Site logo

Comments (7)

kanethal avatar kanethal commented on May 23, 2024

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.

sebelga avatar sebelga commented on May 23, 2024

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.

kanethal avatar kanethal commented on May 23, 2024

from gstore-node.

kanethal avatar kanethal commented on May 23, 2024

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
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
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.

kanethal avatar kanethal commented on May 23, 2024

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.

sebelga avatar sebelga commented on May 23, 2024

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.

sebelga avatar sebelga commented on May 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.