Code Monkey home page Code Monkey logo

ezydata's Issues

Custom Query mongoDB problem

If use this custom query with all other needed implementations:

@EzyQuery("{$query: {?0:'?1'},{_id:1, ?2:1}")
StringValue getStringFieldByValue(String field, String value, String retValue);

for now i use this to test to get the datas available if the below Error not there:

@Data
@EzyCollection
public class StringValue {
    @EzyId
    Long id;

    String username;
}

the call looks :

StringValue value = accountService.getStringFieldByValue("email", request.getEmail(), "username");

I get this error if i call the custom query somewere. I think the major error from the list are:

readStartArray can only be called when CurrentBSONType is ARRAY, not when CurrentBSONType is DOCUMENT.
The Query should normal do this db.account.FindOne({email:'[email protected]'}, {_id:0, username:1})
returns: [ { username: 'yourusername' } ]

this query should be universal to get a string back there are two problems if i write it back to the StringValue object, this need the id but i dont need and set it _id:0 and i dont now realy if String named username:

@Data
@EzyCollection
public class StringValue {
    @EzyId
    Long id;

    String username;
}

is there a example to get out a value from the query lets say i turn this to a String instead a StringValue object

public StringValue getStringFieldByValue(String field, String value, String retValue) {
  return accountRepo.getStringFieldByValue(field, value, retValue);
}

something like:

public String getStringFieldByValue(String field, String value, String retValue) {
    String value =  accountRepo.getStringFieldByValue(field, value, retValue);
   // how to extract the value of retValue as string from the returned query if the above error  not exist enymore;
   // In this example  yourusername value [ { username: 'yourusername' } ] 
  return value:
}

Feature request ezydata-mongodb to perform a case-insensitive search

Is your feature request related to a problem? Please describe.

public Account getAccountByUsername(String username)
{
return accountRepo.findByField("username", username);
}

does not match if the username in database is "Paul" and the given String username is "paul"

Describe the solution you'd like

It should be a solution or query that have a option to case-insensitive search so that String "paul" match in database with "Paul", "PAUL", "paul", "pAUl", .

e.g.
findByField("username", username, true); or findByField("username", username, false); Or some separate function to get this behaviour.

Describe alternatives you've considered


Additional context


Feature request ezydata-mongodb, write single value in collection without loading and saving the whole object

Is your feature request related to a problem? Please describe.
public void SetNewPassword(Long id, String password)
{
Account account = accountRepo.findById(id);
account.setPassword(password);
accountRepo.save(account);
}

i need to save the whole account object instead of saving only the required field password

Describe the solution you'd like
there should be get some function to save only a single value by id like
saveValueById(id, "field-in-the-collection", value)
Same for a get a single value
Int/String value = getValueById(id, "field-in-the-collection")

There are a lot of usecases to need only save a single value instead of the full object. like Character stats, inventory(load a inventory Object with 100 entries rewrite a single value and write it back to db) maybe isnt good for server performance and for large Objects.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

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.