Search list of unique _id as String in mongoDB with find()

Genry

I would like to find a list of different values with unique _id but the problem is that they are saved as String and if I try to search f.e 10 it finds me also 100, 101, 102 etc.. In my case { "_id" : { "$gte" : "10" , "$lte" : "15"}} I would like to find 10, 11, 12, 13, 14, 15. But it finds me also 100, 110, 120 etc..

Thanks for your help

Ori Dar

You have two more options:

  • Issue a $regex query: {_id : /^1[0-5]/} (not sure about the PCRE syntax)
  • Add a new field whose value is the numeric equivalent of _id and query that new field

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

C# Find string in List<string> in MongoDB

From Dev

Find a mongodb document using a partial _id string

From Dev

mongodb get _id as string in find query

From Dev

Find documents with array of string ID's in MongoDB

From Dev

MongoDB - find all search string words in multiple fields

From Dev

MongoDB - find all search string words in multiple fields

From Dev

Find if a string is unique or not

From Dev

Getting Unique Id for a list

From Dev

Getting Unique Id for a list

From Dev

mongodb search for list of ids

From Dev

mongoDB prefix wildcard: fulltext-search ($text) find part with search-string

From Dev

mongoDB prefix wildcard: fulltext-search ($text) find part with search-string

From Dev

Doctrine MongoDB find by id

From Dev

MongoDB combining find with text search

From Dev

Find unique pairs in list of pairs

From Dev

Mongodb Text Search and ID field

From Dev

How to search for a specific string on a list from a dictionary and return all element that contain that string in mongodb?

From Dev

Eloquent - use unique string or unique int as id

From Dev

Eloquent - use unique string or unique int as id

From Dev

Find if all letters in a string are unique

From Dev

MongoDB: nested search in list of DBREFs

From Dev

MongoDB: nested search in list of DBREFs

From Dev

Search for a string in a list of strings for a string

From Dev

c# Search Result From Contains String Class Contains List For Find String

From Dev

c# Search Result From Contains String Class Contains List For Find String

From Dev

Search Table for Multiple Results and Unique ID SQL

From Dev

Find id that are not part of a list

From Dev

MongoDB, convert string to list

From Dev

How to find the max number of an unique string element in a alphanumeric Array list in java

Related Related

  1. 1

    C# Find string in List<string> in MongoDB

  2. 2

    Find a mongodb document using a partial _id string

  3. 3

    mongodb get _id as string in find query

  4. 4

    Find documents with array of string ID's in MongoDB

  5. 5

    MongoDB - find all search string words in multiple fields

  6. 6

    MongoDB - find all search string words in multiple fields

  7. 7

    Find if a string is unique or not

  8. 8

    Getting Unique Id for a list

  9. 9

    Getting Unique Id for a list

  10. 10

    mongodb search for list of ids

  11. 11

    mongoDB prefix wildcard: fulltext-search ($text) find part with search-string

  12. 12

    mongoDB prefix wildcard: fulltext-search ($text) find part with search-string

  13. 13

    Doctrine MongoDB find by id

  14. 14

    MongoDB combining find with text search

  15. 15

    Find unique pairs in list of pairs

  16. 16

    Mongodb Text Search and ID field

  17. 17

    How to search for a specific string on a list from a dictionary and return all element that contain that string in mongodb?

  18. 18

    Eloquent - use unique string or unique int as id

  19. 19

    Eloquent - use unique string or unique int as id

  20. 20

    Find if all letters in a string are unique

  21. 21

    MongoDB: nested search in list of DBREFs

  22. 22

    MongoDB: nested search in list of DBREFs

  23. 23

    Search for a string in a list of strings for a string

  24. 24

    c# Search Result From Contains String Class Contains List For Find String

  25. 25

    c# Search Result From Contains String Class Contains List For Find String

  26. 26

    Search Table for Multiple Results and Unique ID SQL

  27. 27

    Find id that are not part of a list

  28. 28

    MongoDB, convert string to list

  29. 29

    How to find the max number of an unique string element in a alphanumeric Array list in java

HotTag

Archive